Skip to content

Commit

Permalink
sql/migrate: add support for directory checkpoints (#1971)
Browse files Browse the repository at this point in the history
  • Loading branch information
a8m committed Aug 10, 2023
1 parent 377c95e commit b3b1ccd
Show file tree
Hide file tree
Showing 6 changed files with 388 additions and 127 deletions.
6 changes: 0 additions & 6 deletions cmd/atlas/internal/cmdapi/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ type migrateApplyFlags struct {
logFormat string
lockTimeout time.Duration
allowDirty bool // allow working on a database that already has resources
fromVersion string // compute pending files based on this version
baselineVersion string // apply with this version as baseline
txMode string // (none, file, all)
}
Expand All @@ -87,9 +86,6 @@ func (f *migrateApplyFlags) migrateOptions() (opts []migrate.ExecutorOption) {
if v := f.baselineVersion; v != "" {
opts = append(opts, migrate.WithBaselineVersion(v))
}
if v := f.fromVersion; v != "" {
opts = append(opts, migrate.WithFromVersion(v))
}
return
}

Expand Down Expand Up @@ -141,11 +137,9 @@ If run with the "--dry-run" flag, atlas will not execute any SQL.`,
addFlagRevisionSchema(cmd.Flags(), &flags.revisionSchema)
addFlagDryRun(cmd.Flags(), &flags.dryRun)
addFlagLockTimeout(cmd.Flags(), &flags.lockTimeout)
cmd.Flags().StringVarP(&flags.fromVersion, flagFrom, "", "", "calculate pending files from the given version (including it)")
cmd.Flags().StringVarP(&flags.baselineVersion, flagBaseline, "", "", "start the first migration after the given baseline version")
cmd.Flags().StringVarP(&flags.txMode, flagTxMode, "", txModeFile, "set transaction mode [none, file, all]")
cmd.Flags().BoolVarP(&flags.allowDirty, flagAllowDirty, "", false, "allow start working on a non-clean database")
cmd.MarkFlagsMutuallyExclusive(flagFrom, flagBaseline)
cmd.MarkFlagsMutuallyExclusive(flagLog, flagFormat)
return cmd
}
Expand Down
1 change: 0 additions & 1 deletion doc/md/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ If run with the "--dry-run" flag, atlas will not execute any SQL.
--revisions-schema string name of the schema the revisions table resides in
--dry-run print SQL without executing it
--lock-timeout duration set how long to wait for the database lock (default 10s)
--from string calculate pending files from the given version (including it)
--baseline string start the first migration after the given baseline version
--tx-mode string set transaction mode [none, file, all] (default "file")
--allow-dirty allow start working on a non-clean database
Expand Down

0 comments on commit b3b1ccd

Please sign in to comment.