File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1039,6 +1039,11 @@ func (mctx *MigrationContext) CancelContext() {
10391039 }
10401040}
10411041
1042+ // IsMoveTablesMode returns true if gh-ost should be used for moving tables instead of running a schema migration.
1043+ func (mctx * MigrationContext ) IsMoveTablesMode () bool {
1044+ return len (mctx .MoveTables .TableNames ) > 0
1045+ }
1046+
10421047// SendWithContext attempts to send a value to a channel, but returns early
10431048// if the context is cancelled. This prevents goroutine deadlocks when the
10441049// channel receiver has exited due to an error.
Original file line number Diff line number Diff line change @@ -415,6 +415,8 @@ func main() {
415415 var err error
416416 if migrationContext .Revert {
417417 err = migrator .Revert ()
418+ } else if migrationContext .IsMoveTablesMode () {
419+ err = migrator .MoveTables ()
418420 } else {
419421 err = migrator .Migrate ()
420422 }
Original file line number Diff line number Diff line change @@ -769,6 +769,10 @@ func (mgtr *Migrator) Revert() error {
769769 return nil
770770}
771771
772+ func (mgtr * Migrator ) MoveTables () error {
773+ return nil
774+ }
775+
772776// ExecOnFailureHook executes the onFailure hook, and this method is provided as the only external
773777// hook access point
774778func (mgtr * Migrator ) ExecOnFailureHook () (err error ) {
You can’t perform that action at this time.
0 commit comments