Versions in this module Expand all Collapse all v0 v0.1.1 Nov 10, 2026 v0.1.0 Oct 11, 2026 Changes in this version + const DefaultLedgerTable + const DefaultLockWait + const DefaultStaleAfter + var ErrBadMigration = errors.New(...) + var ErrCheckFailed = errors.New("migrate: a check statement returned rows") + var ErrChecksumMismatch = errors.New("migrate: a migration changed after it was applied") + var ErrLocked = errors.New("migrate: another process holds the migration lock") + var ErrNilTable = errors.New("migrate: a contribution holds a nil table") + var ErrNoLedgerDialect = errors.New("migrate: the ledger supports postgres, mysql and sqlite") + var ErrNoTypeMapping = errors.New("migrate: engine has no mapping for this column type") + var ErrUnknownMigration = errors.New("migrate: the database has a migration this code does not know") + func Checksum(s ddl.Script) string + func CreateIndexes(d render.Dialect, t schema.Table) []string + func CreateTable(d render.Dialect, t schema.Table) (string, error) + func Engines() []string + func Execute(ctx context.Context, conn *sql.Conn, s ddl.Script) error + func ExecuteDB(ctx context.Context, db *sql.DB, s ddl.Script) error + func Install(contribs ...Contribution) (ddl.Script, error) + func Plan(d render.Dialect, s schema.Set) ([]string, error) + func SQLType(d render.Dialect, c schema.Column) (string, error) + type AppliedMigration struct + AppliedAt time.Time + Checksum string + Name string + Owner string + type Contribution struct + Owner string + Tables []Table + type Ledger struct + func NewLedger(d render.Dialect, table string, lock Locker) (Ledger, error) + func (l Ledger) Applied(ctx context.Context, conn *sql.Conn) ([]AppliedMigration, error) + func (l Ledger) AppliedDB(ctx context.Context, db *sql.DB) ([]AppliedMigration, error) + func (l Ledger) Apply(ctx context.Context, conn *sql.Conn, ms ...Migration) (applied []string, err error) + func (l Ledger) ApplyDB(ctx context.Context, db *sql.DB, ms ...Migration) ([]string, error) + func (l Ledger) RefuseUnknown() Ledger + type Locker interface + Lock func(ctx context.Context, conn *sql.Conn) error + Unlock func(ctx context.Context, conn *sql.Conn) error + func EngineLock(d render.Dialect, key string) Locker + type Migration struct + Name string + Owner string + Script ddl.Script + type MySQLNamedLock struct + Name string + func (m MySQLNamedLock) Lock(ctx context.Context, conn *sql.Conn) error + func (m MySQLNamedLock) Unlock(ctx context.Context, conn *sql.Conn) error + type PostgresAdvisoryLock struct + Key int64 + func (p PostgresAdvisoryLock) Lock(ctx context.Context, conn *sql.Conn) error + func (p PostgresAdvisoryLock) Unlock(ctx context.Context, conn *sql.Conn) error + type Table interface + Build func() (ddl.Script, error) + Describe func() (schema.Table, error) + type TableLock struct + Dialect render.Dialect + Holder string + StaleAfter time.Duration + Table string + func (t TableLock) Lock(ctx context.Context, conn *sql.Conn) error + func (t TableLock) Unlock(ctx context.Context, conn *sql.Conn) error