Documentation
¶
Overview ¶
Package migrate is imported by other Go code. It is the entry point to all migration functions.
Index ¶
- Constants
- func NewPipe() chan interface{}
- type Migrator
- func (m *Migrator) Create(incMajor bool, name string, contents ...string) (*file.MigrationFile, error)
- func (m *Migrator) Down(pipe chan interface{}, conn driver.Conn)
- func (m *Migrator) DownSync(conn driver.Conn) []error
- func (m *Migrator) Dump(pipe chan interface{}, conn driver.CopyConn, dw file.DumpWriter)
- func (m *Migrator) DumpSync(conn driver.CopyConn, dw file.DumpWriter) []error
- func (m *Migrator) Migrate(pipe chan interface{}, conn driver.Conn, relativeN int)
- func (m *Migrator) MigrateBetween(pipe chan interface{}, conn driver.Conn) (curVersion, dstVersion file.Version)
- func (m *Migrator) MigrateBetweenSync(conn driver.Conn) (curVersion, dstVersion file.Version, errs []error)
- func (m *Migrator) MigrateFiles(pipe chan interface{}, conn driver.Conn, prevFiles, files file.MigrationFiles, ...)
- func (m *Migrator) MigrateSync(conn driver.Conn, relativeN int) []error
- func (m *Migrator) MigrateTo(pipe chan interface{}, conn driver.Conn, dstVersion file.Version) (version file.Version)
- func (m *Migrator) MigrateToSync(conn driver.Conn, dstVersion file.Version) (version file.Version, errs []error)
- func (m *Migrator) Redo(pipe chan interface{}, conn driver.Conn)
- func (m *Migrator) RedoSync(conn driver.Conn) []error
- func (m *Migrator) Reset(pipe chan interface{}, conn driver.Conn)
- func (m *Migrator) ResetSync(conn driver.Conn) []error
- func (m *Migrator) Restore(pipe chan interface{}, conn driver.CopyConn, dr file.DumpReader)
- func (m *Migrator) RestoreSync(conn driver.CopyConn, dr file.DumpReader) []error
- func (m *Migrator) Up(pipe chan interface{}, conn driver.Conn)
- func (m *Migrator) UpSync(conn driver.Conn) []error
- func (m *Migrator) Version(conn driver.Conn) (version file.Version, err error)
Constants ¶
View Source
const SchemaDir = "schema/"
SchemaDir is the dir used to store schema migrations in dump files
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Migrator ¶ added in v1.3.0
type Migrator struct {
Driver driver.Driver
// Path for schema migrations.
Path string
// // Path for storing executed migrations that are used for validation and for downgrading when the versions don't exist in MigrationsPath
// PrevPath string
// True if a transaction should be used for each file instead of per each major version
TxPerFile bool
// True if the migration should be interruptable
Interrupts bool
// Don't validate base upfiles
Force bool
// Schema to use
// Schema string
Schema string
}
Migrator struct
func (*Migrator) Create ¶ added in v1.3.0
func (m *Migrator) Create(incMajor bool, name string, contents ...string) (*file.MigrationFile, error)
Create creates new migration files on disk
func (*Migrator) Dump ¶ added in v1.3.0
func (m *Migrator) Dump(pipe chan interface{}, conn driver.CopyConn, dw file.DumpWriter)
func (*Migrator) MigrateBetween ¶ added in v1.3.0
func (m *Migrator) MigrateBetween(pipe chan interface{}, conn driver.Conn) (curVersion, dstVersion file.Version)
MigrateBetween migrates to the destination version
func (*Migrator) MigrateBetweenSync ¶ added in v1.3.0
func (m *Migrator) MigrateBetweenSync(conn driver.Conn) (curVersion, dstVersion file.Version, errs []error)
MigrateBetweenSync is synchronous version of MigrateBetween
func (*Migrator) MigrateFiles ¶ added in v1.3.0
func (m *Migrator) MigrateFiles(pipe chan interface{}, conn driver.Conn, prevFiles, files file.MigrationFiles, applyMigrations file.Migrations)
MigrateFiles applies migrations in given files
func (*Migrator) MigrateSync ¶ added in v1.3.0
MigrateSync is synchronous version of Migrate
func (*Migrator) MigrateTo ¶ added in v1.3.0
func (m *Migrator) MigrateTo(pipe chan interface{}, conn driver.Conn, dstVersion file.Version) (version file.Version)
MigrateTo migrates to the destination version
func (*Migrator) MigrateToSync ¶ added in v1.3.0
func (m *Migrator) MigrateToSync(conn driver.Conn, dstVersion file.Version) (version file.Version, errs []error)
MigrateToSync is synchronous version of MigrateTo
func (*Migrator) Redo ¶ added in v1.3.0
Redo rolls back the most recently applied migration, then runs it again.
func (*Migrator) Restore ¶ added in v1.3.0
func (m *Migrator) Restore(pipe chan interface{}, conn driver.CopyConn, dr file.DumpReader)
func (*Migrator) RestoreSync ¶ added in v1.3.0
RestoreSync is synchronous version of Restore
Directories
¶
| Path | Synopsis |
|---|---|
|
Package direction just holds convenience constants for Up and Down migrations.
|
Package direction just holds convenience constants for Up and Down migrations. |
|
Package txtype just holds constants for per file and single transaction types.
|
Package txtype just holds constants for per file and single transaction types. |
Click to show internal directories.
Click to hide internal directories.