v1.12.3 Latest Latest

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

Go to latest
Published: Nov 8, 2020 License: Apache-2.0 Imports: 13 Imported by: 493



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


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.



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



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("] [-dir="path/to/migration"]

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

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

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

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

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

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


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


This section is empty.

Jump to

Keyboard shortcuts

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