Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
func Exec(db *sql.DB, m MigrationSource, dir MigrationDirection) (int, error)
Exec executes a set of migrations Returns the number of applied migrations.
func SetMigrationsTableName ¶
func SetMigrationsTableName(name string)
SetMigrationsTableName sets the table name for the applied migrations
Types ¶
type AppliedMigration ¶
AppliedMigration is an applied migration stored in a table
type ApplyMigrationError ¶
ApplyMigrationError is an error while applying a migration
func (ApplyMigrationError) Error ¶
func (a ApplyMigrationError) Error() string
Error returns a string representation of the ApplyMigrationError
type MemoryMigrationSource ¶
type MemoryMigrationSource struct {
Migrations []*Migration
}
MemoryMigrationSource returns the migrations passed as parameter in the constructor
func (MemoryMigrationSource) FindMigrations ¶
func (m MemoryMigrationSource) FindMigrations() ([]*Migration, error)
FindMigrations returns the migrations to be applied
type MigrationDirection ¶
type MigrationDirection uint8
MigrationDirection is a migration direction
const ( Up MigrationDirection = iota + 1 Down )
these are the possible migration direction
type MigrationSource ¶
type MigrationSource interface { // Finds the migrations. // The resulting slice of migrations should be sorted by Id. FindMigrations() ([]*Migration, error) }
MigrationSource is the interface for retrieving the migrations to be applied
Click to show internal directories.
Click to hide internal directories.