Set default db driver as postgres
@@ -31,13 +31,13 @@ func TestDB() *gorm.DB {
dbhost = os.Getenv("DB_HOST")
}
- if os.Getenv("TEST_DB") == "postgres" {
- db, err = gorm.Open("postgres", fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=disable", dbuser, dbpwd, dbhost, dbname))
- } else {
+ if os.Getenv("TEST_DB") == "mysql" {
// CREATE USER 'qor'@'localhost' IDENTIFIED BY 'qor';
// CREATE DATABASE qor_test;
// GRANT ALL ON qor_test.* TO 'qor'@'localhost';
db, err = gorm.Open("mysql", fmt.Sprintf("%s:%s@/%s?charset=utf8&parseTime=True&loc=Local", dbuser, dbpwd, dbname))
+ } else {
+ db, err = gorm.Open("postgres", fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=disable", dbuser, dbpwd, dbhost, dbname))
}
if err != nil {
