mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-11 23:50:04 +01:00
Add Up command to create database and migrate
This commit is contained in:
parent
1c4cf2c122
commit
164ec81370
5 changed files with 125 additions and 31 deletions
35
main.go
35
main.go
|
|
@ -35,20 +35,6 @@ func NewApp() *cli.App {
|
|||
}
|
||||
|
||||
app.Commands = []cli.Command{
|
||||
{
|
||||
Name: "migrate",
|
||||
Usage: "Migrate to the latest version",
|
||||
Action: func(ctx *cli.Context) {
|
||||
runCommand(MigrateCommand, ctx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "rollback",
|
||||
Usage: "Rollback the most recent migration",
|
||||
Action: func(ctx *cli.Context) {
|
||||
runCommand(RollbackCommand, ctx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "new",
|
||||
Usage: "Generate a new migration file",
|
||||
|
|
@ -56,6 +42,13 @@ func NewApp() *cli.App {
|
|||
runCommand(NewCommand, ctx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "up",
|
||||
Usage: "Create database (if necessary) and migrate to the latest version",
|
||||
Action: func(ctx *cli.Context) {
|
||||
runCommand(UpCommand, ctx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "create",
|
||||
Usage: "Create database",
|
||||
|
|
@ -70,6 +63,20 @@ func NewApp() *cli.App {
|
|||
runCommand(DropCommand, ctx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "migrate",
|
||||
Usage: "Migrate to the latest version",
|
||||
Action: func(ctx *cli.Context) {
|
||||
runCommand(MigrateCommand, ctx)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "rollback",
|
||||
Usage: "Rollback the most recent migration",
|
||||
Action: func(ctx *cli.Context) {
|
||||
runCommand(RollbackCommand, ctx)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return app
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue