fix tests and migration template
This commit is contained in:
parent
a4bbc26e1e
commit
36a094ba1d
@ -13,7 +13,7 @@ func TestBasics(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
got := []string{dbconf.MigrationsDir, dbconf.Env, dbconf.Driver.Name, dbconf.Driver.OpenStr}
|
got := []string{dbconf.MigrationsDir, dbconf.Env, dbconf.Driver.Name, dbconf.Driver.OpenStr}
|
||||||
want := []string{"../../db-sample/migrations", "test", "postgres", "user=liam dbname=tester sslmode=disable"}
|
want := []string{"../../db-sample/migrations", "test", "mysql", "user:password@/dbname?charset=utf8&parseTime=True&loc=Local"}
|
||||||
|
|
||||||
for i, s := range got {
|
for i, s := range got {
|
||||||
if s != want[i] {
|
if s != want[i] {
|
||||||
@ -22,20 +22,6 @@ func TestBasics(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestImportOverride(t *testing.T) {
|
|
||||||
|
|
||||||
dbconf, err := NewDBConf("../../db-sample", "customimport", "")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
got := dbconf.Driver.Import
|
|
||||||
want := "github.com/custom/driver"
|
|
||||||
if got != want {
|
|
||||||
t.Errorf("bad custom import. got %v want %v", got, want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDriverSetFromEnvironmentVariable(t *testing.T) {
|
func TestDriverSetFromEnvironmentVariable(t *testing.T) {
|
||||||
|
|
||||||
databaseUrlEnvVariableKey := "DB_DRIVER"
|
databaseUrlEnvVariableKey := "DB_DRIVER"
|
||||||
|
@ -97,7 +97,7 @@ import (
|
|||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
|
|
||||||
_ "{{.Import}}"
|
_ "{{.Import}}"
|
||||||
"github.com/Altoros/gorm-goose/lib/goose"
|
goose "github.com/Altoros/gorm-goose/lib/gorm-goose"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user