commands

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 CommandAll

func CommandAll(cfg config.MigConfig) result.Response

func CommandCreate

func CommandCreate(cfg config.MigConfig, name string) result.Response

func CommandDown

func CommandDown(cfg config.MigConfig) result.Response

func CommandInit

func CommandInit(cfg config.MigConfig) result.Response

func CommandList

func CommandList(cfg config.MigConfig) result.Response

func CommandLock

func CommandLock(cfg config.MigConfig) result.Response

func CommandStatus

func CommandStatus(cfg config.MigConfig) result.Response

Provide a narrative to the user about the current status of mig Inspired by `git status` and `brew doctor`

func CommandUnlock

func CommandUnlock(cfg config.MigConfig) result.Response

func CommandUp

func CommandUp(cfg config.MigConfig) result.Response

func CommandUpto added in v0.2.1

func CommandUpto(cfg config.MigConfig, target string) result.Response

func CommandVersion added in v0.1.1

func CommandVersion(cfg config.MigConfig) result.Response

func Dispatch

func Dispatch(cfg config.MigConfig, subcommands []string) result.Response

func SanitizeName added in v0.2.0

func SanitizeName(name string) string

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 CommandVersionResult struct {
	Version   string `json:"version"`
	BuildTime string `json:"build_time"`
}

type MigrationName added in v0.3.0

type MigrationName struct {
	Migration string `json:"migration"`
}

type StatusResponse added in v0.3.0

type StatusResponse struct {
	Locked bool `json:"locked"`
	Status any  `json:"status"`
}

Jump to

Keyboard shortcuts

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