All packages

    github.com/pressly/goose/v3

    import "github.com/pressly/goose/v3"

    Go 1.26.1

    Constants

    const (
    	// DefaultTablename is the default name of the database table used to track history of applied
    	// migrations.
    	DefaultTablename = "goose_db_version"
    )

    github.com/pressly/goose/v3/provider_options.go:15

    const VERSION = "v3.18.0"

    Deprecated: VERSION will no longer be supported in the next major release.

    github.com/pressly/goose/v3/goose.go:12

    Variables

    var (
    	// ErrVersionNotFound is returned when a specific migration version is not located. This can
    	// occur if a .sql file or a Go migration function for the specified version is missing.
    	ErrVer...

    github.com/pressly/goose/v3/provider_errors.go:18

    var (
    	// ErrNoMigrationFiles when no migration files have been found.
    	ErrNoMigrationFiles = errors.New("no migration files found")
    	// ErrNoCurrentVersion when a current migration version is not ...

    github.com/pressly/goose/v3/migrate.go:23

    var (
    	// ErrNoMigrationFiles when no migration files have been found.
    	ErrNoMigrationFiles = errors.New("no migration files found")
    	// ErrNoCurrentVersion when a current migration version is not ...

    github.com/pressly/goose/v3/migrate.go:21

    var (
    	// ErrVersionNotFound is returned when a specific migration version is not located. This can
    	// occur if a .sql file or a Go migration function for the specified version is missing.
    	ErrVer...

    github.com/pressly/goose/v3/provider_errors.go:14

    var (
    	// ErrNoMigrationFiles when no migration files have been found.
    	ErrNoMigrationFiles = errors.New("no migration files found")
    	// ErrNoCurrentVersion when a current migration version is not ...

    github.com/pressly/goose/v3/migrate.go:25

    var (
    	// ErrVersionNotFound is returned when a specific migration version is not located. This can
    	// occur if a .sql file or a Go migration function for the specified version is missing.
    	ErrVer...

    github.com/pressly/goose/v3/provider_errors.go:22

    var (
    	// ErrVersionNotFound is returned when a specific migration version is not located. This can
    	// occur if a .sql file or a Go migration function for the specified version is missing.
    	ErrVer...

    github.com/pressly/goose/v3/provider_errors.go:11

    var (
    	// ErrNoMigrationFiles when no migration files have been found.
    	ErrNoMigrationFiles = errors.New("no migration files found")
    	// ErrNoCurrentVersion when a current migration version is not ...

    github.com/pressly/goose/v3/migrate.go:27

    Functions

    func AddMigration(up GoMigration, down GoMigration)

    AddMigration adds Go migrations. Deprecated: Use AddMigrationContext.

    github.com/pressly/goose/v3/register.go:108

    func AddMigrationContext(up GoMigrationContext, down GoMigrationContext)

    AddMigrationContext adds Go migrations.

    github.com/pressly/goose/v3/register.go:15

    func AddMigrationNoTx(up GoMigrationNoTx, down GoMigrationNoTx)

    AddMigrationNoTx adds Go migrations that will be run outside transaction. Deprecated: Use AddMigrationNoTxContext.

    github.com/pressly/goose/v3/register.go:123

    func AddMigrationNoTxContext(up GoMigrationNoTxContext, down GoMigrationNoTxContext)

    AddMigrationNoTxContext adds Go migrations that will be run outside transaction.

    github.com/pressly/goose/v3/register.go:37

    func AddNamedMigration(filename string, up GoMigration, down GoMigration)

    AddNamedMigration adds named Go migrations. Deprecated: Use AddNamedMigrationContext.

    github.com/pressly/goose/v3/register.go:116

    func AddNamedMigrationContext(filename string, up GoMigrationContext, down GoMigrationContext)

    AddNamedMigrationContext adds named Go migrations.

    github.com/pressly/goose/v3/register.go:21

    func AddNamedMigrationNoTx(filename string, up GoMigrationNoTx, down GoMigrationNoTx)

    AddNamedMigrationNoTx adds named Go migrations that will be run outside transaction. Deprecated: Use AddNamedMigrationNoTxContext.

    github.com/pressly/goose/v3/register.go:131

    func AddNamedMigrationNoTxContext(filename string, up GoMigrationNoTxContext, down GoMigrationNoTxContext)

    AddNamedMigrationNoTxContext adds named Go migrations that will be run outside transaction.

    github.com/pressly/goose/v3/register.go:43

    func CollectMigrations(dirpath string, current int64, target int64) (Migrations, error)

    CollectMigrations returns all the valid looking migration scripts in the migrations folder and go func registry, and key them by version.

    github.com/pressly/goose/v3/migrate.go:176

    func Create(db *sql.DB, dir string, name string, migrationType string) error

    Create writes a new blank migration file.

    github.com/pressly/goose/v3/create.go:80

    func CreateWithTemplate(db *sql.DB, dir string, tmpl *template.Template, name string, migrationType string) error

    Create writes a new blank migration file.

    github.com/pressly/goose/v3/create.go:28

    func Down(db *sql.DB, dir string, opts ...OptionsFunc) error

    Down rolls back a single migration from the current version.

    github.com/pressly/goose/v3/down.go:11

    func DownContext(ctx context.Context, db *sql.DB, dir string, opts ...OptionsFunc) error

    DownContext rolls back a single migration from the current version.

    github.com/pressly/goose/v3/down.go:17

    func DownTo(db *sql.DB, dir string, version int64, opts ...OptionsFunc) error

    DownTo rolls back migrations to a specific version.

    github.com/pressly/goose/v3/down.go:46

    func DownToContext(ctx context.Context, db *sql.DB, dir string, version int64, opts ...OptionsFunc) error

    DownToContext rolls back migrations to a specific version.

    github.com/pressly/goose/v3/down.go:52

    func EnsureDBVersion(db *sql.DB) (int64, error)

    EnsureDBVersion retrieves the current version for this DB. Create and initialize the DB version table if it doesn't exist.

    github.com/pressly/goose/v3/migrate.go:209

    func EnsureDBVersionContext(ctx context.Context, db *sql.DB) (int64, error)

    EnsureDBVersionContext retrieves the current version for this DB. Create and initialize the DB version table if it doesn't exist.

    github.com/pressly/goose/v3/migrate.go:216

    func Fix(dir string) error

    github.com/pressly/goose/v3/fix.go:12

    func GetDBVersion(db *sql.DB) (int64, error)

    GetDBVersion is an alias for EnsureDBVersion, but returns -1 in error.

    github.com/pressly/goose/v3/migrate.go:273

    func GetDBVersionContext(ctx context.Context, db *sql.DB) (int64, error)

    GetDBVersionContext is an alias for EnsureDBVersion, but returns -1 in error.

    github.com/pressly/goose/v3/migrate.go:279

    func NewGoMigration(version int64, up *GoFunc, down *GoFunc) *Migration

    NewGoMigration creates a new Go migration. Both up and down functions may be nil, in which case the migration will be recorded in the versions table but no functions will be run. This is useful for recording (up) or deleting (down) a version without running any functions. See [GoFunc] for more details.

    github.com/pressly/goose/v3/migration.go:21

    func NewProvider(dialect Dialect, db *sql.DB, fsys fs.FS, opts ...ProviderOption) (*Provider, error)

    NewProvider returns a new goose provider. The caller is responsible for matching the database dialect with the database/sql driver. For example, if the database dialect is "postgres", the database/sql driver could be github.com/lib/pq or github.com/jackc/pgx. Each dialect has a corresponding [database.Dialect] constant backed by a default [database.Store] implementation. For more advanced use cases, such as using a custom table name or supplying a custom store implementation, see [WithStore]...

    github.com/pressly/goose/v3/provider.go:58

    func NopLogger() Logger

    NopLogger returns a logger that discards all logged output.

    github.com/pressly/goose/v3/log.go:27

    func NumericComponent(filename string) (int64, error)

    NumericComponent parses the version from the migration file name. XXX_descriptivename.ext where XXX specifies the version number and ext specifies the type of migration, either .sql or .go.

    github.com/pressly/goose/v3/migration.go:363

    func OpenDBWithDriver(driver string, dbstring string) (*sql.DB, error)

    OpenDBWithDriver creates a connection to a database, and modifies goose internals to be compatible with the supplied driver by calling SetDialect.

    github.com/pressly/goose/v3/db.go:10

    func Redo(db *sql.DB, dir string, opts ...OptionsFunc) error

    Redo rolls back the most recently applied migration, then runs it again.

    github.com/pressly/goose/v3/redo.go:9

    func RedoContext(ctx context.Context, db *sql.DB, dir string, opts ...OptionsFunc) error

    RedoContext rolls back the most recently applied migration, then runs it again.

    github.com/pressly/goose/v3/redo.go:15

    func Reset(db *sql.DB, dir string, opts ...OptionsFunc) error

    Reset rolls back all migrations

    github.com/pressly/goose/v3/reset.go:11

    func ResetContext(ctx context.Context, db *sql.DB, dir string, opts ...OptionsFunc) error

    ResetContext rolls back all migrations

    github.com/pressly/goose/v3/reset.go:17

    func ResetGlobalMigrations()

    ResetGlobalMigrations resets the global Go migrations registry. Not safe for concurrent use.

    github.com/pressly/goose/v3/globals.go:16

    func Run(command string, db *sql.DB, dir string, args ...string) error

    Run runs a goose command. Deprecated: Use RunContext.

    github.com/pressly/goose/v3/goose.go:44

    func RunContext(ctx context.Context, command string, db *sql.DB, dir string, args ...string) error

    RunContext runs a goose command.

    github.com/pressly/goose/v3/goose.go:50

    func RunWithOptions(command string, db *sql.DB, dir string, args []string, options ...OptionsFunc) error

    RunWithOptions runs a goose command with options. Deprecated: Use RunWithOptionsContext.

    github.com/pressly/goose/v3/goose.go:57

    func RunWithOptionsContext(ctx context.Context, command string, db *sql.DB, dir string, args []string, options ...OptionsFunc) error

    RunWithOptionsContext runs a goose command with options.

    github.com/pressly/goose/v3/goose.go:63

    func SetBaseFS(fsys fs.FS)

    SetBaseFS sets a base FS to discover migrations. It can be used with 'embed' package. Calling with 'nil' argument leads to default behaviour: discovering migrations from os filesystem. Note that modifying operations like Create will use os filesystem anyway.

    github.com/pressly/goose/v3/goose.go:33

    func SetDialect(s string) error

    SetDialect sets the dialect to use for the goose package.

    github.com/pressly/goose/v3/dialect.go:41

    func SetGlobalMigrations(migrations ...*Migration) error

    SetGlobalMigrations registers Go migrations globally. It returns an error if a migration with the same version has already been registered. Go migrations must be constructed using the [NewGoMigration] function. Not safe for concurrent use.

    github.com/pressly/goose/v3/globals.go:25

    func SetLogger(l Logger)

    SetLogger sets the logger for package output

    github.com/pressly/goose/v3/log.go:16

    func SetSequential(s bool)

    SetSequential set whether to use sequential versioning instead of timestamp based versioning

    github.com/pressly/goose/v3/create.go:23

    func SetTableName(n string)

    SetTableName set goose db version table name

    github.com/pressly/goose/v3/version.go:50

    func SetVerbose(v bool)

    SetVerbose set the goose verbosity mode

    github.com/pressly/goose/v3/goose.go:26

    func Status(db *sql.DB, dir string, opts ...OptionsFunc) error

    Status prints the status of all migrations.

    github.com/pressly/goose/v3/status.go:13

    func StatusContext(ctx context.Context, db *sql.DB, dir string, opts ...OptionsFunc) error

    StatusContext prints the status of all migrations.

    github.com/pressly/goose/v3/status.go:19

    func TableName() string

    TableName returns goose db version table name

    github.com/pressly/goose/v3/version.go:45

    func Up(db *sql.DB, dir string, opts ...OptionsFunc) error

    Up applies all available migrations.

    github.com/pressly/goose/v3/up.go:161

    func UpByOne(db *sql.DB, dir string, opts ...OptionsFunc) error

    UpByOne migrates up by a single version.

    github.com/pressly/goose/v3/up.go:172

    func UpByOneContext(ctx context.Context, db *sql.DB, dir string, opts ...OptionsFunc) error

    UpByOneContext migrates up by a single version.

    github.com/pressly/goose/v3/up.go:178

    func UpContext(ctx context.Context, db *sql.DB, dir string, opts ...OptionsFunc) error

    UpContext applies all available migrations.

    github.com/pressly/goose/v3/up.go:167

    func UpTo(db *sql.DB, dir string, version int64, opts ...OptionsFunc) error

    UpTo migrates up to a specific version.

    github.com/pressly/goose/v3/up.go:36

    func UpToContext(ctx context.Context, db *sql.DB, dir string, version int64, opts ...OptionsFunc) error

    github.com/pressly/goose/v3/up.go:41

    func Version(db *sql.DB, dir string, opts ...OptionsFunc) error

    Version prints the current version of the database.

    github.com/pressly/goose/v3/version.go:10

    func VersionContext(ctx context.Context, db *sql.DB, dir string, opts ...OptionsFunc) error

    VersionContext prints the current version of the database.

    github.com/pressly/goose/v3/version.go:16

    func WithAllowMissing() OptionsFunc

    github.com/pressly/goose/v3/up.go:19

    func WithAllowOutofOrder(b bool) ProviderOption

    WithAllowOutofOrder allows the provider to apply missing (out-of-order) migrations. By default, goose will raise an error if it encounters a missing migration. For example: migrations 1,3 are applied and then version 2,6 are introduced. If this option is true, then goose will apply 2 (missing) and 6 (new) instead of raising an error. The final order of applied migrations will be: 1,3,2,6. Out-of-order migrations are always applied first, followed by new migrations.

    github.com/pressly/goose/v3/provider_options.go:184

    func WithDisableGlobalRegistry(b bool) ProviderOption

    WithDisableGlobalRegistry prevents the provider from registering Go migrations from the global registry. By default, goose will register all Go migrations including those registered globally.

    github.com/pressly/goose/v3/provider_options.go:170

    func WithDisableVersioning(b bool) ProviderOption

    WithDisableVersioning disables versioning. Disabling versioning allows applying migrations without tracking the versions in the database schema table. Useful for tests, seeding a database or running ad-hoc queries. By default, goose will track all versions in the database schema table.

    github.com/pressly/goose/v3/provider_options.go:195

    func WithExcludeNames(excludes []string) ProviderOption

    WithExcludeNames excludes the given file name from the list of migrations. If called multiple times, the list of excludes is merged.

    github.com/pressly/goose/v3/provider_options.go:120

    func WithExcludeVersions(versions []int64) ProviderOption

    WithExcludeVersions excludes the given versions from the list of migrations. If called multiple times, the list of excludes is merged.

    github.com/pressly/goose/v3/provider_options.go:134

    func WithGoMigrations(migrations ...*Migration) ProviderOption

    WithGoMigrations registers Go migrations with the provider. If a Go migration with the same version has already been registered, an error will be returned. Go migrations must be constructed using the [NewGoMigration] function.

    github.com/pressly/goose/v3/provider_options.go:153

    func WithIsolateDDL(b bool) ProviderOption

    WithIsolateDDL executes DDL operations separately from DML operations. This is useful for databases like AWS Aurora DSQL that don't support mixing DDL and DML within the same transaction.

    github.com/pressly/goose/v3/provider_options.go:240

    func WithLocker(locker lock.Locker) ProviderOption

    WithLocker enables locking using the provided Locker. If WithLocker is not called, locking is disabled. Must not be used together with [WithSessionLocker].

    github.com/pressly/goose/v3/provider_options.go:98

    func WithLogger(l Logger) ProviderOption

    WithLogger will set a custom Logger, which will override the default logger. Cannot be used together with [WithSlog].

    github.com/pressly/goose/v3/provider_options.go:204

    func WithNoColor(b bool) OptionsFunc

    github.com/pressly/goose/v3/up.go:27

    func WithNoVersioning() OptionsFunc

    github.com/pressly/goose/v3/up.go:23

    func WithSessionLocker(locker lock.SessionLocker) ProviderOption

    WithSessionLocker enables locking using the provided SessionLocker. If WithSessionLocker is not called, locking is disabled. Must not be used together with [WithLocker].

    github.com/pressly/goose/v3/provider_options.go:74

    func WithSlog(logger *slog.Logger) ProviderOption

    WithSlog will set a custom [*slog.Logger] for structured logging. This enables rich structured logging with attributes like source, direction, duration, etc. Cannot be used together with [WithLogger]. Example: logger := slog.New(slog.NewTextHandler(os.Stdout, nil)) p, err := goose.NewProvider("postgres", db, fs, goose.WithSlog(logger))

    github.com/pressly/goose/v3/provider_options.go:225

    func WithStore(store database.Store) ProviderOption

    WithStore configures the provider with a custom [database.Store], allowing users to bring their own implementation of the store interface. When this option is used, the dialect parameter of [NewProvider] must be set to [DialectCustom]. This option cannot be used together with [WithTableName], since the table name is set on the store. By default, the provider uses the [database.NewStore] function to create a store backed by one of the officially supported dialects.

    github.com/pressly/goose/v3/provider_options.go:32

    func WithTableName(name string) ProviderOption

    WithTableName sets the name of the database table used to track history of applied migrations. This option cannot be used together with [WithStore], since the table name is set on the store. Default is "goose_db_version".

    github.com/pressly/goose/v3/provider_options.go:52

    func WithVerbose(b bool) ProviderOption

    WithVerbose enables verbose logging.

    github.com/pressly/goose/v3/provider_options.go:63

    Types

    type Dialect = database.Dialect

    Dialect is the type of database dialect. It is an alias for [database.Dialect].

    github.com/pressly/goose/v3/dialect.go:11

    type GoFunc struct {
    	// Exactly one of these must be set, or both must be nil.
    	RunTx func(ctx context.Context, tx *sql.Tx) error
    	// -- OR --
    	RunDB func(ctx context.Context, db *sql.DB) error
    
    	...

    GoFunc represents a Go migration function.

    github.com/pressly/goose/v3/migration.go:135

    type GoMigration func(tx *sql.Tx) error

    GoMigration is a Go migration func that is run within a transaction. Deprecated: Use GoMigrationContext.

    github.com/pressly/goose/v3/register.go:98

    type GoMigrationContext func(ctx context.Context, tx *sql.Tx) error

    GoMigrationContext is a Go migration func that is run within a transaction and receives a context.

    github.com/pressly/goose/v3/register.go:12

    type GoMigrationNoTx func(db *sql.DB) error

    GoMigrationNoTx is a Go migration func that is run outside a transaction. Deprecated: Use GoMigrationNoTxContext.

    github.com/pressly/goose/v3/register.go:103

    type GoMigrationNoTxContext func(ctx context.Context, db *sql.DB) error

    GoMigrationNoTxContext is a Go migration func that is run outside a transaction and receives a context.

    github.com/pressly/goose/v3/register.go:34

    type Logger interface {
    	Fatalf(format string, v ...any)
    	Printf(format string, v ...any)
    }

    Logger is standard logger interface

    github.com/pressly/goose/v3/log.go:10

    type Migration struct {
    	Type    MigrationType
    	Version int64
    	// Source is the path to the .sql script or .go file. It may be empty for Go migrations that
    	// have been registered globally and don...

    Migration struct represents either a SQL or Go migration. Avoid constructing migrations manually, use [NewGoMigration] function.

    github.com/pressly/goose/v3/migration.go:85

    func (m *Migration) Down(db *sql.DB) error

    Down runs a down migration.

    github.com/pressly/goose/v3/migration.go:201

    func (m *Migration) DownContext(ctx context.Context, db *sql.DB) error

    DownContext runs a down migration.

    github.com/pressly/goose/v3/migration.go:207

    func (m *Migration) String() string

    github.com/pressly/goose/v3/migration.go:182

    func (m *Migration) Up(db *sql.DB) error

    Up runs an up migration.

    github.com/pressly/goose/v3/migration.go:187

    func (m *Migration) UpContext(ctx context.Context, db *sql.DB) error

    UpContext runs an up migration.

    github.com/pressly/goose/v3/migration.go:193

    type MigrationRecord struct {
    	VersionID int64
    	TStamp    time.Time
    	IsApplied bool // was this a result of up() or down()
    }

    MigrationRecord struct. Deprecated: unused and will be removed in a future major version.

    github.com/pressly/goose/v3/migration.go:176

    type MigrationResult struct {
    	Source    *Source
    	Duration  time.Duration
    	Direction string
    	// Empty indicates no action was taken during the migration, but it was still versioned. For
    	// SQL, it...

    MigrationResult is the result of a single migration operation.

    github.com/pressly/goose/v3/provider_types.go:28

    func (m *MigrationResult) String() string

    String returns a string representation of the migration result. Example down: EMPTY down 00006_posts_view-copy.sql (607.83µs) OK down 00005_posts_view.sql (646.25µs) Example up: OK up 00005_posts_view.sql (727.5µs) EMPTY up 00006_posts_view-copy.sql (378.33µs)

    github.com/pressly/goose/v3/provider_types.go:50

    type Migrations []*Migration

    Migrations slice.

    github.com/pressly/goose/v3/migrate.go:31

    func (ms Migrations) Current(current int64) (*Migration, error)

    Current gets the current migration.

    github.com/pressly/goose/v3/migrate.go:44

    func (ms Migrations) Last() (*Migration, error)

    Last gets the last migration.

    github.com/pressly/goose/v3/migrate.go:77

    func (ms Migrations) Len() int

    helpers so we can use pkg sort

    github.com/pressly/goose/v3/migrate.go:34

    func (ms Migrations) Less(i int, j int) bool

    github.com/pressly/goose/v3/migrate.go:36

    func (ms Migrations) String() string

    github.com/pressly/goose/v3/migrate.go:122

    func (ms Migrations) Swap(i int, j int)

    github.com/pressly/goose/v3/migrate.go:35

    type MigrationStatus struct {
    	Source    *Source
    	State     State
    	AppliedAt time.Time
    }

    MigrationStatus represents the status of a single migration.

    github.com/pressly/goose/v3/provider_types.go:87

    type MigrationType string

    MigrationType is the type of migration.

    github.com/pressly/goose/v3/provider_types.go:10

    type OptionsFunc func(o *options)

    github.com/pressly/goose/v3/up.go:17

    type PartialError struct {
    	// Applied are migrations that were applied successfully before the error occurred. May be
    	// empty.
    	Applied []*MigrationResult
    	// Failed contains the result of the m...

    PartialError is returned when a migration fails, but some migrations already got applied.

    github.com/pressly/goose/v3/provider_errors.go:29

    func (e *PartialError) Error() string

    github.com/pressly/goose/v3/provider_errors.go:39

    func (e *PartialError) Unwrap() error

    github.com/pressly/goose/v3/provider_errors.go:46

    type Provider struct {
    	// contains filtered or unexported fields
    }

    Provider is a goose migration provider.

    github.com/pressly/goose/v3/provider.go:25

    func (p *Provider) ApplyVersion(ctx context.Context, version int64, direction bool) (*MigrationResult, error)

    ApplyVersion applies exactly one migration for the specified version. If there is no migration available for the specified version, this method returns [ErrVersionNotFound]. If the migration has already been applied, this method returns [ErrAlreadyApplied]. The direction parameter determines the migration direction: true for up migration and false for down migration.

    github.com/pressly/goose/v3/provider.go:223

    func (p *Provider) Close() error

    Close closes the database connection initially supplied to the provider.

    github.com/pressly/goose/v3/provider.go:213

    func (p *Provider) Down(ctx context.Context) (*MigrationResult, error)

    Down rolls back the most recently applied migration. If there are no migrations to rollback, this method returns [ErrNoNextVersion]. Note, migrations are rolled back in the order they were applied. And not in the reverse order of the migration version. This only applies in scenarios where migrations are allowed to be applied out of order.

    github.com/pressly/goose/v3/provider.go:308

    func (p *Provider) DownTo(ctx context.Context, version int64) ([]*MigrationResult, error)

    DownTo rolls back all migrations down to, but not including, the specified version. For example, if the current database version is 11,10,9... and the requested version is 9, only migrations 11, 10 will be rolled back. Note, migrations are rolled back in the order they were applied. And not in the reverse order of the migration version. This only applies in scenarios where migrations are allowed to be applied out of order.

    github.com/pressly/goose/v3/provider.go:338

    func (p *Provider) GetDBVersion(ctx context.Context) (int64, error)

    GetDBVersion returns the highest version recorded in the database, regardless of the order in which migrations were applied. For example, if migrations were applied out of order (1,4,2,3), this method returns 4. If no migrations have been applied, it returns 0.

    github.com/pressly/goose/v3/provider.go:185

    func (p *Provider) GetVersions(ctx context.Context) (int64, error)

    GetVersions returns the max database version and the target version to migrate to. Note, this method will not use a SessionLocker or Locker if one is configured. This allows callers to check for versions without blocking or being blocked by other operations.

    github.com/pressly/goose/v3/provider.go:178

    func (p *Provider) HasPending(ctx context.Context) (bool, error)

    HasPending returns true if there are pending migrations to apply, otherwise, it returns false. If out-of-order migrations are disabled, yet some are detected, this method returns an error. Note, this method will not use a SessionLocker or Locker if one is configured. This allows callers to check for pending migrations without blocking or being blocked by other operations.

    github.com/pressly/goose/v3/provider.go:170

    func (p *Provider) ListSources() []*Source

    ListSources returns a list of all migration sources known to the provider, sorted in ascending order by version. The path field may be empty for manually registered migrations, such as Go migrations registered using the [WithGoMigrations] option.

    github.com/pressly/goose/v3/provider.go:195

    func (p *Provider) Ping(ctx context.Context) error

    Ping attempts to ping the database to verify a connection is available.

    github.com/pressly/goose/v3/provider.go:208

    func (p *Provider) Status(ctx context.Context) ([]*MigrationStatus, error)

    Status returns the status of all migrations, merging the list of migrations from the database and filesystem. The returned items are ordered by version, in ascending order.

    github.com/pressly/goose/v3/provider.go:161

    func (p *Provider) Up(ctx context.Context) ([]*MigrationResult, error)

    Up applies all pending migrations. If there are no new migrations to apply, this method returns empty list and nil error.

    github.com/pressly/goose/v3/provider.go:244

    func (p *Provider) UpByOne(ctx context.Context) (*MigrationResult, error)

    UpByOne applies the next pending migration. If there is no next migration to apply, this method returns [ErrNoNextVersion].

    github.com/pressly/goose/v3/provider.go:257

    func (p *Provider) UpTo(ctx context.Context, version int64) ([]*MigrationResult, error)

    UpTo applies all pending migrations up to, and including, the specified version. If there are no migrations to apply, this method returns empty list and nil error. For example, if there are three new migrations (9,10,11) and the current database version is 8 with a requested version of 10, only versions 9,10 will be applied.

    github.com/pressly/goose/v3/provider.go:291

    type ProviderOption interface {
    	// contains filtered or unexported methods
    }

    ProviderOption is a configuration option for a goose goose.

    github.com/pressly/goose/v3/provider_options.go:19

    type Source struct {
    	Type    MigrationType
    	Path    string
    	Version int64
    }

    Source represents a single migration source. The Path field may be empty if the migration was registered manually. This is typically the case for Go migrations registered using the [WithGoMigration] option.

    github.com/pressly/goose/v3/provider_types.go:21

    type State string

    State represents the state of a migration.

    github.com/pressly/goose/v3/provider_types.go:72

    type TransactionMode int

    TransactionMode represents the possible transaction modes for a migration.

    github.com/pressly/goose/v3/migration.go:155

    func (m TransactionMode) String() string

    github.com/pressly/goose/v3/migration.go:162