Documentation
¶
Overview ¶
Package dbmigrate provides the PostgreSQL migration mechanics shared by services while leaving each service in control of its migration streams, ledger names, queue schema, and surrounding bootstrap policy.
Index ¶
- Variables
- func NewGooseProvider(databaseConnection *sql.DB, migrations fs.FS, trackingTable string) (*goose.Provider, error)
- func NewGooseStore(trackingTable string) (database.Store, error)
- func NewRiverMigrator[TTx any](driver riverdriver.Driver[TTx], schema string) (*rivermigrate.Migrator[TTx], error)
- func WithPostgresSessionLock(ctx context.Context, databaseConnection *sql.DB, name string, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
var ErrLockNotHeld = errors.New("database advisory lock was not held")
ErrLockNotHeld reports that PostgreSQL did not release the requested lock from the dedicated session that acquired it.
Functions ¶
func NewGooseProvider ¶
func NewGooseProvider(databaseConnection *sql.DB, migrations fs.FS, trackingTable string) (*goose.Provider, error)
NewGooseProvider creates a PostgreSQL Goose provider without changing Goose's package globals. The caller owns the migration stream and tracking table name.
func NewGooseStore ¶
NewGooseStore creates a PostgreSQL migration store using the caller's tracking table without changing Goose's package globals.
func NewRiverMigrator ¶
func NewRiverMigrator[TTx any](driver riverdriver.Driver[TTx], schema string) (*rivermigrate.Migrator[TTx], error)
NewRiverMigrator creates a River migrator targeting an explicit schema.
func WithPostgresSessionLock ¶
func WithPostgresSessionLock( ctx context.Context, databaseConnection *sql.DB, name string, operation func(context.Context) error, ) (err error)
WithPostgresSessionLock runs operation while holding a named PostgreSQL advisory lock. The lock is acquired and released on the same dedicated connection because advisory locks are scoped to a backend session.
Types ¶
This section is empty.