Versions in this module Expand all Collapse all v0 v0.1.1 May 16, 2021 v0.1.0 May 15, 2021 Changes in this version + var ErrNoCurrentVersion = errors.New("no current version found") + var ErrNoNextVersion = errors.New("no next version found") + var MaxVersion int64 = 9223372036854775807 + func AddMigration(up func(*sql.Tx) error, down func(*sql.Tx) error) + func AddNamedMigration(filename string, up func(*sql.Tx) error, down func(*sql.Tx) error) + func Create(dir, name, migrationType string) error + func CreateWithTemplate(dir string, tmpl *template.Template, name, migrationType string) (err error) + func Down(db *sql.DB, dir string) error + func DownTo(db *sql.DB, dir string, version int64) error + func EnsureDBVersion(db *sql.DB) (int64, error) + func Fix(dir string) error + func GetDBVersion(db *sql.DB) (int64, error) + func NumericComponent(name string) (int64, error) + func OpenDBWithDriver(driver string, dbstring string) (*sql.DB, error) + func Redo(db *sql.DB, dir string) error + func Reset(db *sql.DB, dir string) error + func Run(command string, dir string, args ...string) error + func SetDialect(d string) error + func SetLogger(l Logger) + func SetSequential(s bool) + func SetTableName(n string) + func SetVerbose(v bool) + func Status(db *sql.DB, dir string) error + func TableName() string + func Up(db *sql.DB, dir string) error + func UpByOne(db *sql.DB, dir string) error + func UpTo(db *sql.DB, dir string, version int64) error + type ClickHouseDialect struct + type Logger interface + Fatal func(v ...interface{}) + Fatalf func(format string, v ...interface{}) + Print func(v ...interface{}) + Printf func(format string, v ...interface{}) + Println func(v ...interface{}) + type Migration struct + DownFn func(*sql.Tx) error + Next int64 + Previous int64 + Registered bool + Source string + SourceReader io.ReadCloser + UpFn func(*sql.Tx) error + Version int64 + func (m *Migration) Down(db *sql.DB) error + func (m *Migration) String() string + func (m *Migration) Up(db *sql.DB) error + type MigrationRecord struct + IsApplied bool + TStamp time.Time + VersionID int64 + type Migrations []*Migration + func CollectMigrations(dirpath string, current, target int64) (Migrations, error) + func (ms Migrations) Current(current int64) (*Migration, error) + func (ms Migrations) Down(db *sql.DB) error + func (ms Migrations) DownTo(db *sql.DB, targetVersion int64) error + func (ms Migrations) Last() (*Migration, error) + func (ms Migrations) Len() int + func (ms Migrations) Less(i, j int) bool + func (ms Migrations) Next(current int64) (*Migration, error) + func (ms Migrations) Previous(current int64) (*Migration, error) + func (ms Migrations) Redo(db *sql.DB) error + func (ms Migrations) Reset(db *sql.DB) error + func (ms Migrations) Status(db *sql.DB) error + func (ms Migrations) String() string + func (ms Migrations) Swap(i, j int) + func (ms Migrations) Up(db *sql.DB) error + func (ms Migrations) UpByOne(db *sql.DB) error + type MySQLDialect struct + type PostgresDialect struct + type RedshiftDialect struct + type SQLDialect interface + func GetDialect() SQLDialect + type SQLServerDialect struct + type Sqlite3Dialect struct + type TiDBDialect struct