Setup mssql test env

This commit is contained in:
Jinzhu 2017-03-22 18:01:29 +08:00
parent 66982a7047
commit 403487d5dd
2 changed files with 7 additions and 2 deletions

View File

@ -58,8 +58,13 @@ func OpenTestConnection() (db *gorm.DB, err error) {
fmt.Println("testing foundation...")
db, err = gorm.Open("foundation", "dbname=gorm port=15432 sslmode=disable")
case "mssql":
// CREATE LOGIN gorm WITH PASSWORD = 'LoremIpsum86';
// CREATE DATABASE gorm;
// USE gorm;
// CREATE USER gorm FROM LOGIN gorm;
// sp_changedbowner 'gorm';
fmt.Println("testing mssql...")
db, err = gorm.Open("mssql", "server=SERVER_HERE;database=rogue;user id=USER_HERE;password=PW_HERE;port=1433")
db, err = gorm.Open("mssql", "sqlserver://gorm:LoremIpsum86@localhost:1433?database=gorm")
default:
fmt.Println("testing sqlite3...")
db, err = gorm.Open("sqlite3", filepath.Join(os.TempDir(), "gorm.db"))

View File

@ -1,4 +1,4 @@
dialects=("postgres" "mysql" "sqlite")
dialects=("postgres" "mysql" "sqlite" "mssql")
for dialect in "${dialects[@]}" ; do
GORM_DIALECT=${dialect} go test