Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Migrate ¶
func Migrate(db *sql.DB, migrations migrate.MigrationSource, dir MigrateDir, count int) (int, error)
Migrate performs schema migration. Migrations can occur in one of three ways:
- up: migrations are performed from the currently installed version upwards. If count is 0, all unapplied migrations will be run.
- down: migrations are performed from the current version downard. If count is 0, all applied migrations will be run in a downard direction.
- redo: migrations are first ran downard `count` times, and then are rand upward back to the current version at the start of the process. If count is 0, a count of 1 will be assumed.
Types ¶
type MigrateDir ¶
type MigrateDir string
MigrateDir represents a direction in which to perform schema migrations.
const ( // MigrateUp causes migrations to be run in the "up" direction. MigrateUp MigrateDir = "up" // MigrateDown causes migrations to be run in the "down" direction. MigrateDown MigrateDir = "down" // MigrateRedo causes migrations to be run down, then up MigrateRedo MigrateDir = "redo" )
Click to show internal directories.
Click to hide internal directories.