Skip to content

Commit

Permalink
change to cmd to not apply new migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
ndyakov committed Apr 18, 2022
1 parent fad15ab commit d9370ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions cmd/gloat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,11 @@ func migrateToCmd(args arguments) error {

migrations, err := gl.AppliedAfter(version)
if err != nil {
if err == gloat.ErrNotFound {
return upCmd(args)
}
return err
}

for _, migration := range migrations {
fmt.Printf("\nReverting: %d...\n", migration.Version)
fmt.Printf("Reverting: %d...\n", migration.Version)

if err := gl.Revert(migration); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions gloat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ func TestAppliedAfter(t *testing.T) {
},
}

migrations, err := gl.AppliedAfter(20180329154959)
migrations, err := gl.AppliedAfter(20170329154959)
assert.Nil(t, err)

assert.NotNil(t, migrations)
require.Len(t, migrations, 1)
require.Len(t, migrations, 2)
assert.Equal(t, int64(20190329154959), migrations[0].Version)
assert.True(t, migrations[0].Reversible())
}
Expand Down

0 comments on commit d9370ef

Please sign in to comment.