mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-11 23:50:04 +01:00
Ability to specify custom migrations table name (#178)
Supported via `--migrations-table` CLI flag or `DBMATE_MIGRATIONS_TABLE` environment variable. Specified table name is quoted when necessary. For PostgreSQL specifically, it's also possible to specify a custom schema (for example: `--migrations-table=foo.migrations`). Closes #168
This commit is contained in:
parent
656dc0253a
commit
c907c3f5c6
15 changed files with 807 additions and 325 deletions
7
main.go
7
main.go
|
|
@ -52,6 +52,12 @@ func NewApp() *cli.App {
|
|||
Value: dbmate.DefaultMigrationsDir,
|
||||
Usage: "specify the directory containing migration files",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "migrations-table",
|
||||
EnvVars: []string{"DBMATE_MIGRATIONS_TABLE"},
|
||||
Value: dbmate.DefaultMigrationsTableName,
|
||||
Usage: "specify the database table to record migrations in",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "schema-file",
|
||||
Aliases: []string{"s"},
|
||||
|
|
@ -222,6 +228,7 @@ func action(f func(*dbmate.DB, *cli.Context) error) cli.ActionFunc {
|
|||
db := dbmate.New(u)
|
||||
db.AutoDumpSchema = !c.Bool("no-dump-schema")
|
||||
db.MigrationsDir = c.String("migrations-dir")
|
||||
db.MigrationsTableName = c.String("migrations-table")
|
||||
db.SchemaFile = c.String("schema-file")
|
||||
db.WaitBefore = c.Bool("wait")
|
||||
overrideTimeout := c.Duration("wait-timeout")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue