migrate

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2013 bee authors

Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// MigrationMainTPL migration main template
	MigrationMainTPL = `` /* 628-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}}

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

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

    $ bee 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}}

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

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

    $ bee 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