Documentation
¶
Overview ¶
Package migrate provides database migration runners and CLI commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedDialect = errors.New("unsupported migration dialect")
ErrUnsupportedDialect reports that a migration dialect is not supported.
Functions ¶
Types ¶
type GooseRunner ¶
type GooseRunner struct {
// contains filtered or unexported fields
}
GooseRunner applies migrations with goose.
func New ¶
New creates a goose-backed migration runner. The caller owns db and remains responsible for closing it.
func NewFromDir ¶
NewFromDir creates a goose-backed migration runner from a local directory.
func (*GooseRunner) Down ¶
func (r *GooseRunner) Down(ctx context.Context) (Result, error)
Down rolls back one migration.
func (*GooseRunner) Reset ¶
func (r *GooseRunner) Reset(ctx context.Context) ([]Result, error)
Reset rolls back all applied migrations.
type Option ¶
type Option func(*gooseOptions)
Option configures a GooseRunner.
func WithTableName ¶
WithTableName configures the migration version table name.
type Result ¶
type Result struct {
Version int64
Source string
Direction string
Duration time.Duration
Empty bool
Skipped bool
}
Result describes one applied migration.
Click to show internal directories.
Click to hide internal directories.