Commit 84bc8073 authored by Bobby Rullo's avatar Bobby Rullo

functional: Test DBs use migrations

All repo tests build their tables by applying all the migrations. This
way we know our migrations are functional.
parent c16e3b5a
......@@ -40,10 +40,12 @@ func connect(t *testing.T) *gorp.DbMap {
t.Fatalf("Unable to drop database tables: %v", err)
}
if err = c.CreateTablesIfNotExists(); err != nil {
t.Fatalf("Unable to create database tables: %v", err)
if err = db.DropMigrationsTable(c); err != nil {
panic(fmt.Sprintf("Unable to drop migration table: %v", err))
}
db.MigrateToLatest(c)
return c
}
......
......@@ -18,8 +18,10 @@ func initDB(dsn string) *gorp.DbMap {
panic(fmt.Sprintf("Unable to drop database tables: %v", err))
}
if err = c.CreateTablesIfNotExists(); err != nil {
panic(fmt.Sprintf("Unable to create database tables: %v", err))
if err = db.DropMigrationsTable(c); err != nil {
panic(fmt.Sprintf("Unable to drop migration table: %v", err))
}
db.MigrateToLatest(c)
return c
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment