Skip to content

Commit

Permalink
Add a comment and case for down case
Browse files Browse the repository at this point in the history
  • Loading branch information
mfridman committed May 20, 2023
1 parent 04f720d commit 6e60936
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/e2e/allow_missing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func TestMigrateAllowMissingDown(t *testing.T) {
}
}

func TestUpWithAndWithoutAllowMissing(t *testing.T) {
func TestWithWithoutAllowMissing(t *testing.T) {
// Test for https://github.com/pressly/goose/issues/521

// Apply 1,2,4,3 then run up without allow missing. If the next requested migration is
Expand All @@ -335,6 +335,20 @@ func TestUpWithAndWithoutAllowMissing(t *testing.T) {
check.NoError(t, err)
err = goose.UpTo(db, migrationsDir, 4, goose.WithAllowMissing())
check.NoError(t, err)

// Rollback migration 3 because it is the last applied migration.
// But, we want to change this behaviour to apply rollback migration 4.
// See these issues for more details:
// https://github.com/pressly/goose/issues/523
// https://github.com/pressly/goose/issues/402
//
// Adding this test to ensure the behaviour is updated and captured in a test.
err = goose.Down(db, migrationsDir)
check.NoError(t, err)

version, err := goose.GetDBVersion(db)
check.NoError(t, err)
check.Number(t, version, 4)
}

// setupTestDB is helper to setup a DB and apply migrations
Expand Down

0 comments on commit 6e60936

Please sign in to comment.