migrate

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MigrationMainTPL migration main template
	MigrationMainTPL = `` /* 648-byte string literal not displayed */

	// MYSQLMigrationDDL MySQL migration SQL
	MYSQLMigrationDDL = `` /* 621-byte string literal not displayed */

	// POSTGRESMigrationDDL Postgres migration SQL
	POSTGRESMigrationDDL = `` /* 286-byte string literal not displayed */

)

Variables

View Source
var CmdMigrate = &commands.Command{
	UsageLine: "migrate [Command]",
	Short:     "Runs database migrations",
	Long: `The command 'migrate' allows you to run database migrations to keep it up-to-date.

  ▶ {{"To run all the migrations:"|bold}}

    $ radical migrate [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"] [-dir="path/to/migration"]

  ▶ {{"To rollback the last migration:"|bold}}

    $ radical migrate rollback [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"] [-dir="path/to/migration"]

  ▶ {{"To do a reset, which will rollback all the migrations:"|bold}}

    $ radical migrate reset [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"] [-dir="path/to/migration"]

  ▶ {{"To update your schema:"|bold}}

    $ radical migrate refresh [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"] [-dir="path/to/migration"]
`,
	PreRun: func(cmd *commands.Command, args []string) { version.ShowShortVersionBanner() },
	Run:    RunMigration,
}

Functions

func MigrateRefresh

func MigrateRefresh(currpath, driver, connStr, dir string)

MigrateRefresh rolls back all migrations and start over again

func MigrateReset

func MigrateReset(currpath, driver, connStr, dir string)

MigrateReset rolls back all migrations

func MigrateRollback

func MigrateRollback(currpath, driver, connStr, dir string)

MigrateRollback rolls back the latest migration

func MigrateUpdate

func MigrateUpdate(currpath, driver, connStr, dir string)

MigrateUpdate does the schema update

func RunMigration

func RunMigration(cmd *commands.Command, args []string) int

runMigration is the entry point for starting a migration

Types

This section is empty.

Jump to

Keyboard shortcuts

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