Documentation ¶
Index ¶
- Constants
- Variables
- func CommandAll(cfg config.MigConfig) result.Response
- func CommandCreate(cfg config.MigConfig, name string) result.Response
- func CommandDown(cfg config.MigConfig) result.Response
- func CommandInit(cfg config.MigConfig) result.Response
- func CommandList(cfg config.MigConfig) result.Response
- func CommandLock(cfg config.MigConfig) result.Response
- func CommandStatus(cfg config.MigConfig) result.Response
- func CommandUnlock(cfg config.MigConfig) result.Response
- func CommandUp(cfg config.MigConfig) result.Response
- func CommandUpto(cfg config.MigConfig, target string) result.Response
- func CommandVersion(cfg config.MigConfig) result.Response
- func Dispatch(cfg config.MigConfig, subcommands []string) result.Response
- func SanitizeName(name string) string
- type CommandCreateResult
- type CommandUpFamilyResult
- type CommandUpResult
- type CommandUptoResult
- type CommandVersionResult
- type MigrationName
- type StatusResponse
Constants ¶
View Source
const TEMPLATE = `` /* 183-byte string literal not displayed */
Variables ¶
View Source
var BuildTime string // set at compile time
View Source
var DESCRIBE = database.QueryBox{
Postgres: `SELECT
table_name,
column_name,
data_type
FROM
information_schema.columns
WHERE
table_name = 'migrations' OR table_name = 'migrations_lock'
ORDER BY
table_name, column_name;`,
Mysql: `DESC migrations;`,
Sqlite: `pragma table_info('migrations');`,
}
View Source
var EXIST_LOCK = database.QueryBox{
Postgres: `SELECT EXISTS (
SELECT FROM
pg_tables
WHERE
schemaname = 'public' AND
tablename = 'migrations_lock'
) AS table_exists;`,
Mysql: `CALL sys.table_exists(DATABASE(), 'migrations_lock', @table_type); SELECT @table_type LIKE 'BASE TABLE';`,
Sqlite: `SELECT COUNT(name) >= 1 AS table_is_present FROM sqlite_master WHERE type='table' AND name='migrations_lock';`,
}
View Source
var EXIST_MIGRATIONS = database.QueryBox{
Postgres: `SELECT EXISTS (
SELECT FROM
pg_tables
WHERE
schemaname = 'public' AND
tablename = 'migrations'
) AS table_exists;`,
Mysql: `CALL sys.table_exists(DATABASE(), 'migrations', @table_type); SELECT @table_type LIKE 'BASE TABLE';`,
Sqlite: `SELECT COUNT(name) >= 1 AS table_is_present FROM sqlite_master WHERE type='table' AND name='migrations';`,
}
View Source
var LOCK_STATUS = database.QueryBox{
Postgres: `SELECT is_locked FROM migrations_lock WHERE index = 1;`,
Mysql: `SELECT is_locked FROM migrations_lock WHERE ` + "`index`" + ` = 1;`,
Sqlite: `SELECT is_locked FROM migrations_lock WHERE "index" = 1;`,
}
View Source
var Version string // set at compile time
Functions ¶
func CommandStatus ¶
Provide a narrative to the user about the current status of mig Inspired by `git status` and `brew doctor`
func CommandUpto ¶ added in v0.2.1
func SanitizeName ¶ added in v0.2.0
Types ¶
type CommandCreateResult ¶ added in v0.3.0
type CommandCreateResult struct {
Filename string `json:"filename"`
}
type CommandUpFamilyResult ¶ added in v0.3.0
type CommandUpFamilyResult struct { MigrationBatch int `json:"batch"` Migrations *[]migrations.MigrationRow `json:"migrations"` }
type CommandUpResult ¶ added in v0.3.0
type CommandUpResult struct { MigrationBatch int `json:"batch"` Migration *migrations.MigrationRow `json:"migration"` }
type CommandUptoResult ¶ added in v0.3.0
type CommandUptoResult struct {
History []migrations.MigrationRowStatus `json:"history"`
}
type CommandVersionResult ¶ added in v0.3.0
type MigrationName ¶ added in v0.3.0
type MigrationName struct {
Migration string `json:"migration"`
}
type StatusResponse ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.