Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MigrationsTableName holds default table name for migrations // // Default value is "schema_migration" MigrationsTableName = "schema_migration" )
Functions ¶
This section is empty.
Types ¶
type FileMigrator ¶
FileMigrator is Migrator implementation for SQL files stored on file system
func NewFileMigrator ¶
func NewFileMigrator(path string, dialect string, db db.Store) FileMigrator
NewFileMigrator - creates Migrations for files
type Migration ¶
type Migration struct {
//Version of the migration
//
// for example 2`018051570142`
Version string
// Name of the migration
//
// for exmample `initial`
Name string
// Direction of the migration
//
// for example `up`
Direction string
// Content of migration
//
// Content holds migration SQL query
Content string
}
Migration handles data for a given database migration
type Migrations ¶
type Migrations []Migration
Migrations collection
func (Migrations) Less ¶
func (m Migrations) Less(i, j int) bool
Less checks if migration version at index i is lesss than migration at index j
type Migrator ¶
type Migrator struct {
Migrations map[string]Migrations
// contains filtered or unexported fields
}
Migrator forms the basis of all migration systems.Migrator it does the actual heavy lifting of running migrations
func (Migrator) Down ¶
Down runs pending `down` migrations and rolls back the database by the specified number of steps
Click to show internal directories.
Click to hide internal directories.