Wrap postgres up migrations into a single transaction (#887)

This commit is contained in:
Todd Knight authored and GitHub committed 2021-01-27 15:58:22 -07:00
1 parent c1576dddda
commit d2bb8820ea
9 files changed
+209 -217

No files matched your search

-22
View File
@@ -2,7 +2,6 @@ package schema
import (
"context"
"database/sql"
"testing"
"github.com/hashicorp/boundary/internal/docker"
@@ -42,24 +41,3 @@ func TestMigrateStore(t *testing.T) {
assert.NoError(t, err)
assert.False(t, ran)
}
func TestMigrateStore_Dirty(t *testing.T) {
dialect := "postgres"
ctx := context.Background()
c, u, _, err := docker.StartDbInDocker(dialect)
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, c())
})
// Mark the db as dirty indicating a previously run failed migration
db, err := sql.Open(dialect, u)
require.NoError(t, err)
m, err := NewManager(ctx, dialect, db)
m.driver.SetVersion(ctx, -1, true)
b, err := MigrateStore(ctx, dialect, u)
assert.Error(t, err)
assert.False(t, b)
}