Versions in this module Expand all Collapse all v1 v1.1.0 Aug 25, 2022 Changes in this version + var ErrNoPreviousVersion = errors.New("no previous version found") + var ErrTableDoesNotExist = errors.New("table does not exist") + func CreateMigration(name, migrationType, dir string, t time.Time) (path string, err error) + func EnsureDBVersion(conf *DBConf, db *gorm.DB) (int64, error) + func FinalizeMigration(conf *DBConf, txn *gorm.DB, direction bool, v int64) error + func GetDBVersion(conf *DBConf) (version int64, err error) + func GetMostRecentDBVersion(dirpath string) (version int64, err error) + func GetPreviousDBVersion(dirpath string, version int64) (previous int64, err error) + func MigrateFromDir(con *gorm.DB, migrationsDir string) error + func NumericComponent(name string) (int64, error) + func OpenDBFromDBConf(conf *DBConf) (*gorm.DB, error) + func RunMigrations(conf *DBConf, migrationsDir string, target int64) (err error) + func RunMigrationsOnDb(conf *DBConf, migrationsDir string, target int64, db *gorm.DB) (err error) + type DBConf struct + Driver DBDriver + Env string + MigrationsDir string + PgSchema string + func NewDBConf(p, env string, pgschema string) (*DBConf, error) + type DBDriver struct + Import string + Name string + OpenStr string + func (drv *DBDriver) IsValid() bool + type Migration struct + Next int64 + Previous int64 + Source string + Version int64 + func CollectMigrations(dirpath string, current, target int64) (m []*Migration, err error) + type MigrationRecord struct + ID uint + IsApplied bool + TStamp time.Time + VersionId int64