Use sqlite as default test database

This commit is contained in:
Jinzhu 2014-04-29 16:02:18 +08:00
parent a16a5fca58
commit 1120451108
1 changed files with 5 additions and 5 deletions

View File

@ -7,9 +7,9 @@ import (
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
"github.com/jinzhu/gorm"
"os"
"reflect"
@ -149,12 +149,12 @@ func init() {
// GRANT ALL ON gorm.* TO 'gorm'@'localhost';
fmt.Println("testing mysql...")
db, err = gorm.Open("mysql", "gorm:gorm@/gorm?charset=utf8&parseTime=True")
case "sqlite":
fmt.Println("testing sqlite3...")
db, err = gorm.Open("sqlite3", "/tmp/gorm.db")
default:
case "postgres":
fmt.Println("testing postgres...")
db, err = gorm.Open("postgres", "user=gorm dbname=gorm sslmode=disable")
default:
fmt.Println("testing sqlite3...")
db, err = gorm.Open("sqlite3", "/tmp/gorm.db")
}
// db.SetLogger(Logger{log.New(os.Stdout, "\r\n", 0)})