Versions in this module Expand all Collapse all v1 v1.1.0 Sep 28, 2026 Changes in this version + var ErrBaselineNotAhead = errors.New("baseline version must be later than the current baseline") v1.0.0 Sep 26, 2026 Changes in this version + const DefaultTable + const StatusDown + const StatusUp + var ErrChecksumMismatch = errors.New("checksum mismatch: an applied migration changed on disk since it ran") + var ErrConflictingFlags = errors.New("--baseline cannot be combined with --down or --all") + var ErrFilesMissing = errors.New("migration is recorded as applied but its files are missing from disk") + var ErrNonEmptyTable = errors.New("baseline refuses to run on a non-empty tracking table") + var ErrUnknownVersion = errors.New("baseline version does not match any known migration") + func RunCLI(args []string, dialect Dialect, dir string) int + type Dialect interface + CreateMigrationsTableSQL func(table string) string + Lock func(ctx context.Context, conn *sql.Conn, key string) error + Name func() string + Open func() (*sql.DB, error) + Placeholder func(argPos int) string + SupportsTransactionalDDL func() bool + Unlock func(ctx context.Context, conn *sql.Conn, key string) error + UpsertMigrationSQL func(table string) string + type Migration struct + DownPath string + Name string + UpPath string + Version string + func Load(dir string) ([]Migration, error) + func New(dir, description string) (Migration, error) + type Migrator struct + func NewMigrator(db *sql.DB, dialect Dialect, dir string, table string) *Migrator + func (m *Migrator) Baseline(ctx context.Context, version string, force bool) error + func (m *Migrator) Down(ctx context.Context, all bool, dryRun bool) (*Result, error) + func (m *Migrator) Status(ctx context.Context) ([]StatusRow, error) + func (m *Migrator) Up(ctx context.Context, all bool, dryRun bool) (*Result, error) + type Record struct + Batch int + Checksum string + MigratedAt sql.NullTime + Migration string + RolledBackAt sql.NullTime + RunCount int + Status string + type Result struct + Applied []string + type StatusRow struct + ChecksumMatches bool + FileMissing bool + Migration Migration + Record *Record