Documentation
¶
Overview ¶
Package migrate provides lightweight database migration helpers based on pressly/goose/v3.
Index ¶
- func GetDBVersion(ctx context.Context, db *sql.DB, driver string, opts ...Option) (int64, error)
- func GetStatus(ctx context.Context, db *sql.DB, driver string, fsys fs.FS, dir string, ...) ([]*goose.MigrationStatus, error)
- func NewProvider(db *sql.DB, driver string, fsys fs.FS, dir string, opts ...Option) (*goose.Provider, error)
- func RunDown(ctx context.Context, db *sql.DB, driver string, dir string, opts ...Option) error
- func RunDownFS(ctx context.Context, db *sql.DB, driver string, fsys fs.FS, dir string, ...) error
- func RunUp(ctx context.Context, db *sql.DB, driver string, dir string, opts ...Option) error
- func RunUpFS(ctx context.Context, db *sql.DB, driver string, fsys fs.FS, dir string, ...) error
- func ToGooseDialect(driver string) (goose.Dialect, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDBVersion ¶
GetDBVersion returns the current database version.
func GetStatus ¶
func GetStatus(ctx context.Context, db *sql.DB, driver string, fsys fs.FS, dir string, opts ...Option) ([]*goose.MigrationStatus, error)
GetStatus returns the current migration status list.
func NewProvider ¶
func NewProvider(db *sql.DB, driver string, fsys fs.FS, dir string, opts ...Option) (*goose.Provider, error)
NewProvider creates a new goose.Provider instance with isolated state.
func RunDown ¶
RunDown rolls back the most recently applied migration from a local filesystem directory.
func RunDownFS ¶
func RunDownFS(ctx context.Context, db *sql.DB, driver string, fsys fs.FS, dir string, opts ...Option) error
RunDown rolls back the most recently applied migration from a given fs.FS.
Types ¶
Click to show internal directories.
Click to hide internal directories.