Versions in this module Expand all Collapse all v0 v0.7.0 May 24, 2026 Changes in this version + const DirectionDown + const DirectionUp + const DriverUnknown + var ErrAlreadyApplied = errors.New("migration already applied") + var ErrChecksumMismatch = errors.New("checksum mismatch") + var ErrInvalidMigration = errors.New("invalid migration") + var ErrInvalidMigrationName = errors.New("invalid migration name") + var ErrLockTimeout = errors.New("lock timeout") + var ErrMigrationNotFound = errors.New("migration not found") + var ErrNameTooLong = errors.New("migration name exceeds 63 characters") + var ErrNoDriver = errors.New("driver not initialized") + var ErrNoMigrations = errors.New("no migrations registered") + var ErrVersionConflict = errors.New("version conflict") + func IsValidMigrationName(name string) bool + func IsValidMigrationVersion(version string) bool + type Applied struct + Action string + AppliedAt time.Time + AppliedBy string + Checksum string + DurationMS int64 + Environment string + ErrorMessage string + Hostname string + Name string + Status string + Version string + type Config struct + IsolationLevel sql.IsolationLevel + LockTimeout time.Duration + Naming *NamingConfig + SkipLock bool + TableName string + func DefaultConfig() *Config + type Driver interface + Close func() error + Exec func(ctx context.Context, isolationLevel sql.IsolationLevel, fn func(*sql.Tx) error) error + GetApplied func(ctx context.Context) ([]Applied, error) + Init func(ctx context.Context) error + Lock func(ctx context.Context, timeout time.Duration) error + Record func(ctx context.Context, m *Migration, meta *MigrationMetadata) error + Remove func(ctx context.Context, version string) error + Unlock func(ctx context.Context) error + type Gap struct + AppliedAt *string + BlockedBy []string + Description string + Name string + Severity string + Type GapType + Version string + type GapType string + const GapTypeApplication + const GapTypeNumbering + const GapTypeUnregistered + type IgnoredGap struct + IgnoredAt time.Time + IgnoredBy string + Reason string + Version string + type Logger interface + ErrorContext func(ctx context.Context, msg string, args ...any) + InfoContext func(ctx context.Context, msg string, args ...any) + WarnContext func(ctx context.Context, msg string, args ...any) + type M = Migration + type Migration struct + DownFunc MigrationFunc + DownSQL string + IsolationLevel sql.IsolationLevel + ManualChecksum string + Name string + UpFunc MigrationFunc + UpSQL string + Version string + func (m *Migration) Checksum() string + func (m *Migration) HasRollback() bool + func (m *Migration) IsDestructive() bool + func (m *Migration) Validate() error + type MigrationError struct + Cause error + Driver string + Name string + Operation string + Version string + func (e *MigrationError) Error() string + func (e *MigrationError) Unwrap() error + type MigrationFunc func(ctx context.Context, tx *sql.Tx) error + type MigrationMetadata struct + Action string + AppliedBy string + DurationMS int64 + Environment string + ErrorMessage string + Hostname string + Status string + type MigrationPlan struct + Checksum string + Direction string + HasRollback bool + IsDestructive bool + Name string + SQL string + Status string + Type MigrationType + Version string + Warnings []string + type MigrationStatus struct + AppliedAt *time.Time + Checksum string + Destructive bool + HasRollback bool + Name string + Status Status + Version string + type MigrationType string + const MigrationTypeGoFunc + const MigrationTypeMixed + const MigrationTypeSQL + type NamingConfig struct + Enforce bool + Padding int + Pattern NamingPattern + func DefaultNamingConfig() *NamingConfig + func (nc *NamingConfig) FindNextVersion(existingVersions []string) (string, error) + func (nc *NamingConfig) Validate(version string) error + type NamingPattern string + const NamingPatternNone + const NamingPatternSemver + const NamingPatternSequential + const NamingPatternSequentialPadded + type Option func(*Queen) + func WithLogger(logger Logger) Option + func WithTap(sink tap.Sink) Option + type Queen struct + func New(driver Driver, opts ...Option) *Queen + func NewWithConfig(driver Driver, config *Config, opts ...Option) *Queen + func (q *Queen) Add(m M) error + func (q *Queen) Close() error + func (q *Queen) DetectGaps(ctx context.Context) ([]Gap, error) + func (q *Queen) Down(ctx context.Context, n int) error + func (q *Queen) Driver() Driver + func (q *Queen) DriverName() string + func (q *Queen) DryRun(ctx context.Context, direction string, limit int) ([]MigrationPlan, error) + func (q *Queen) Explain(ctx context.Context, version string) (*MigrationPlan, error) + func (q *Queen) FindMigration(version string) *Migration + func (q *Queen) MustAdd(m M) + func (q *Queen) Reset(ctx context.Context) error + func (q *Queen) SQLDB() *sql.DB + func (q *Queen) SetTap(sink tap.Sink) + func (q *Queen) Status(ctx context.Context) ([]MigrationStatus, error) + func (q *Queen) Up(ctx context.Context) error + func (q *Queen) UpSteps(ctx context.Context, n int) error + func (q *Queen) Validate(ctx context.Context) error + type QueenIgnore struct + func LoadQueenIgnore() (*QueenIgnore, error) + func LoadQueenIgnoreFrom(path string) (*QueenIgnore, error) + func (qi *QueenIgnore) AddIgnore(version, reason, ignoredBy string) error + func (qi *QueenIgnore) GetReason(version string) string + func (qi *QueenIgnore) IsIgnored(version string) bool + func (qi *QueenIgnore) ListIgnored() []*IgnoredGap + func (qi *QueenIgnore) RemoveIgnore(version string) error + func (qi *QueenIgnore) Save() error + type SQLDBProvider interface + SQLDB func() *sql.DB + type Status int + const StatusApplied + const StatusModified + const StatusPending + func (s Status) String() string + type TestHelper struct + func NewTest(t *testing.T, driver Driver) *TestHelper + func (th *TestHelper) MustDown(n int) + func (th *TestHelper) MustReset() + func (th *TestHelper) MustUp() + func (th *TestHelper) MustValidate() + func (th *TestHelper) TestRollback() + func (th *TestHelper) TestUpDown() + type TransactionalRecorder interface + RecordTx func(ctx context.Context, tx *sql.Tx, m *Migration, meta *MigrationMetadata) error + RemoveTx func(ctx context.Context, tx *sql.Tx, version string) error