migrations

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2017 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap(db *gorm.DB) error

Bootstrap creates "migrations" table to keep track of already run database migrations

func Migrate

func Migrate(db *gorm.DB, migrations []MigrationStage) error

Migrate ...

func MigrateAll

func MigrateAll(db *gorm.DB, migrationFunctions []func(*gorm.DB) error)

MigrateAll runs bootstrap, then all migration functions listed against the specified database and logs any errors

func MigrationExists

func MigrationExists(db *gorm.DB, migrationName string) bool

MigrationExists checks if the migration called migrationName has been run already

func SaveMigration

func SaveMigration(db *gorm.DB, migrationName string) error

SaveMigration saves a migration to the migration table

Types

type Migration

type Migration struct {
	gorm.Model
	Name string `sql:"size:255"`
}

Migration represents a single database migration

type MigrationStage

type MigrationStage struct {
	Name     string
	Function func(db *gorm.DB, name string) error
}

MigrationStage ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL