Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶ added in v1.53.0
Apply brings the database at dataSource up to date with the migrations embedded from db/migrations/<driver>. It is the one code path every migration runner shares, so a second entrypoint cannot drift from iam-migrate in lock handling or logging. Concurrent runners are safe: the migrator holds a Postgres advisory lock, so one applies and the rest find nothing pending.
Types ¶
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator runs database schema migrations using goose's Provider API.
func NewWithSessionLock ¶
func NewWithSessionLock(dsn string, driver string, fsys fs.FS, opts ...goose.ProviderOption) (*Migrator, error)
NewWithSessionLock creates a Migrator with a PostgreSQL advisory lock, suitable for in-process use where multiple pods may start concurrently. Only one pod will execute migrations; others block until it completes.
Extra provider options may be supplied; production callers pass none, while tests use them to apply migrations under the lock against an isolated tracking table rather than the production one.