Documentation ¶
Index ¶
- Variables
- func CreateMigration(name, migrationType, dir string, t time.Time) (path string, err error)
- func EnsureDBVersion(conf *DBConf, db *sql.DB) (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 NumericComponent(name string) (int64, error)
- func RunMigrations(conf *DBConf, migrationsDir string, target int64) (err error)
- type DBConf
- type DBDriver
- type Migration
- type MigrationRecord
- type MySqlDialect
- type PostgresDialect
- type SqlDialect
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTableDoesNotExist = errors.New("table does not exist") ErrNoPreviousVersion = errors.New("no previous version found") )
Functions ¶
func CreateMigration ¶
func EnsureDBVersion ¶
retrieve the current version for this DB. Create and initialize the DB version table if it doesn't exist.
func GetDBVersion ¶
wrapper for EnsureDBVersion for callers that don't already have their own DB instance
func GetMostRecentDBVersion ¶
helper to identify the most recent possible version within a folder of migration scripts
func GetPreviousDBVersion ¶
func NumericComponent ¶
look for migration scripts with names in the form:
XXX_descriptivename.ext
where XXX specifies the version number and ext specifies the type of migration
Types ¶
type DBDriver ¶
type DBDriver struct { Name string OpenStr string Import string Dialect SqlDialect }
DBDriver encapsulates the info needed to work with a specific database driver
type Migration ¶
type MigrationRecord ¶
type MySqlDialect ¶
type MySqlDialect struct{}
type PostgresDialect ¶
type PostgresDialect struct{}
type SqlDialect ¶
type SqlDialect interface {
// contains filtered or unexported methods
}
SqlDialect abstracts the details of specific SQL dialects for goose's few SQL specific statements
Click to show internal directories.
Click to hide internal directories.