Documentation
¶
Overview ¶
Package migrate provides explicit migration planning and execution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidMigration reports malformed migration definitions. ErrInvalidMigration = errors.New("migrate: invalid migration") // ErrMigrationConflict reports conflicting migration history, such as an // applied version that is not present in the supplied migration list. ErrMigrationConflict = errors.New("migrate: migration conflict") )
Functions ¶
This section is empty.
Types ¶
type AppliedMigration ¶
AppliedMigration records a migration already applied by a driver.
type Driver ¶
type Driver interface {
// EnsureSchema creates the migration metadata table if needed.
EnsureSchema(ctx context.Context) error
// Applied returns migrations already applied, keyed by version.
Applied(ctx context.Context) (map[int64]AppliedMigration, error)
// Apply applies migration and records it as applied atomically.
Apply(ctx context.Context, migration Migration) error
}
Driver owns dialect-specific migration storage and execution.
type Migration ¶
Migration is a versioned schema change.
SQL contains adapter-specific statements. The shared runner does not inspect or execute SQL directly; concrete database drivers decide how to apply each migration safely for their dialect.
func ApplyPending ¶
ApplyPending applies every pending migration in ascending version order.
Click to show internal directories.
Click to hide internal directories.