basemigrate

package
v0.0.0-...-44af80e Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidHeader is when the changeset header is invalid.
	ErrInvalidHeader = errors.New("invalid changeset header")
	// ErrInvalidFormat is when a changeset is not found.
	ErrInvalidFormat = errors.New("invalid changeset format")
)

Functions

func Migrate

func Migrate(filename string, prefix string, max int, verbose bool) error

Migrate will perform all the migrations in a file. If max is 0, all migrations are run.

func Reset

func Reset(filename string, prefix string, max int, verbose bool) (err error)

Reset will remove all migrations. If max is 0, all rollbacks are run.

Types

type Changeset

type Changeset struct {
	// contains filtered or unexported fields
}

Changeset is a SQL changeset.

func (*Changeset) AddChange

func (cs *Changeset) AddChange(line string)

AddChange will add a change command.

func (*Changeset) AddRollback

func (cs *Changeset) AddRollback(line string)

AddRollback will add a rollback command.

func (*Changeset) Changes

func (cs *Changeset) Changes() string

Changes will return all the changes.

func (*Changeset) Checksum

func (cs *Changeset) Checksum() string

Checksum returns an MD5 checksum for the changeset.

func (*Changeset) ParseHeader

func (cs *Changeset) ParseHeader(line string) error

ParseHeader will parse the header information.

func (*Changeset) Rollbacks

func (cs *Changeset) Rollbacks() string

Rollbacks will return all the rollbacks.

func (*Changeset) SetFileInfo

func (cs *Changeset) SetFileInfo(filename string, description string, version string)

SetFileInfo will set the file information.

type DBChangeset

type DBChangeset struct {
	ID            string `db:"id"`
	Author        string `db:"author"`
	Filename      string `db:"filename"`
	OrderExecuted int    `db:"orderexecuted"`
}

DBChangeset represents the database table records.

Jump to

Keyboard shortcuts

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