Documentation ¶
Overview ¶
Package migrate is imported by other Go code. It is the entry point to all migration functions.
Index ¶
- func Graceful()
- func NewPipe() chan interface{}
- func NonGraceful()
- type Migrator
- func (m Migrator) Create(name string) (*file.MigrationFile, error)
- func (m Migrator) Down(pipe chan interface{})
- func (m Migrator) DownSync() (err []error, ok bool)
- func (m Migrator) Migrate(pipe chan interface{}, relativeN int)
- func (m Migrator) MigrateSync(relativeN int) (err []error, ok bool)
- func (m Migrator) Redo(pipe chan interface{})
- func (m Migrator) RedoSync() (err []error, ok bool)
- func (m Migrator) Reset(pipe chan interface{})
- func (m Migrator) ResetSync() (err []error, ok bool)
- func (m Migrator) Up(pipe chan interface{})
- func (m Migrator) UpSync() (err []error, ok bool)
- func (m Migrator) Version() (version uint64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Graceful ¶
func Graceful()
Graceful enables interrupts checking. Once the first ^C is received it will finish the currently running migration and abort execution of the next migration. If ^C is received twice, it will stop execution immediately.
func NewPipe ¶
func NewPipe() chan interface{}
NewPipe is a convenience function for pipe.New(). This is helpful if the user just wants to import this package and nothing else.
func NonGraceful ¶
func NonGraceful()
NonGraceful disables interrupts checking. The first received ^C will stop execution immediately.
Types ¶
type Migrator ¶ added in v1.91.0
Read migration scripts from a given file store.
In order to use bindata asset as a store:
import "github.com/PlanitarInc/migrate/migrate" import "github.com/PlanitarInc/migrate/file" ... migrate.UseStore(file.AssetStore{ Asset: Asset, AssetDir: AssetDir, })
func (Migrator) Create ¶ added in v1.91.0
func (m Migrator) Create(name string) (*file.MigrationFile, error)
Create creates new migration files on disk
func (Migrator) Down ¶ added in v1.91.0
func (m Migrator) Down(pipe chan interface{})
Down rolls back all migrations
func (Migrator) MigrateSync ¶ added in v1.91.0
MigrateSync is synchronous version of Migrate
func (Migrator) Redo ¶ added in v1.91.0
func (m Migrator) Redo(pipe chan interface{})
Redo rolls back the most recently applied migration, then runs it again.
func (Migrator) Reset ¶ added in v1.91.0
func (m Migrator) Reset(pipe chan interface{})
Reset runs the down and up migration function
func (Migrator) Up ¶ added in v1.91.0
func (m Migrator) Up(pipe chan interface{})
Up applies all available migrations