File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -450,6 +450,7 @@ func (mgtr *Migrator) checkAbort() error {
450450func (mgtr * Migrator ) Migrate () (err error ) {
451451 mgtr .migrationContext .Log .Infof ("Migrating %s.%s" , sql .EscapeName (mgtr .migrationContext .DatabaseName ), sql .EscapeName (mgtr .migrationContext .OriginalTableName ))
452452 mgtr .migrationContext .StartTime = time .Now ()
453+ mgtr .migrationContext .SetLastHeartbeatOnChangelogTime (mgtr .migrationContext .StartTime )
453454
454455 // Ensure context is cancelled on exit (cleanup)
455456 defer mgtr .migrationContext .CancelContext ()
@@ -667,6 +668,7 @@ func (mgtr *Migrator) Revert() error {
667668 sql .EscapeName (mgtr .migrationContext .DatabaseName ), sql .EscapeName (mgtr .migrationContext .OriginalTableName ),
668669 sql .EscapeName (mgtr .migrationContext .DatabaseName ), sql .EscapeName (mgtr .migrationContext .OldTableName ))
669670 mgtr .migrationContext .StartTime = time .Now ()
671+ mgtr .migrationContext .SetLastHeartbeatOnChangelogTime (mgtr .migrationContext .StartTime )
670672
671673 // Ensure context is cancelled on exit (cleanup)
672674 defer mgtr .migrationContext .CancelContext ()
Original file line number Diff line number Diff line change @@ -990,6 +990,7 @@ func (suite *MigratorTestSuite) TestRevertEmpty() {
990990 err = migrator .Migrate ()
991991 oldTableName = migrationContext .GetOldTableName ()
992992 suite .Require ().NoError (err )
993+ suite .Require ().Less (migrationContext .TimeSinceLastHeartbeatOnChangelog (), 24 * time .Hour )
993994 }
994995
995996 // revert the original migration
@@ -1008,6 +1009,7 @@ func (suite *MigratorTestSuite) TestRevertEmpty() {
10081009
10091010 err = migrator .Revert ()
10101011 suite .Require ().NoError (err )
1012+ suite .Require ().Less (migrationContext .TimeSinceLastHeartbeatOnChangelog (), 24 * time .Hour )
10111013 }
10121014}
10131015
You can’t perform that action at this time.
0 commit comments