migrate

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

func (*Migrator) Close

func (m *Migrator) Close() error

func (*Migrator) Up

func (m *Migrator) Up(ctx context.Context, logger *logrus.Entry) error

Up applies all pending migrations in a single locked batch, then logs each one that was applied. Using provider.Up holds the advisory lock for the whole batch, so the logs come after all migrations run rather than incrementally.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL