From d9370efac2eed13576563a56e50607fc1e882139 Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Fri, 18 Mar 2022 12:43:30 +0200 Subject: [PATCH] change to cmd to not apply new migrations --- cmd/gloat/main.go | 5 +---- gloat_test.go | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/gloat/main.go b/cmd/gloat/main.go index 9a2e06d..d54c589 100644 --- a/cmd/gloat/main.go +++ b/cmd/gloat/main.go @@ -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 diff --git a/gloat_test.go b/gloat_test.go index 42894cd..6fb9508 100644 --- a/gloat_test.go +++ b/gloat_test.go @@ -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()) }