skip identity test for table without id column for mssql ref: https://github.com/jinzhu/gorm/issues/647

This commit is contained in:
biju-kalissery 2015-09-08 13:57:14 -04:00
parent 93a2c6827d
commit b71fda1a1a

View File

@ -4,6 +4,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"time" "time"
"os"
) )
func TestCreate(t *testing.T) { func TestCreate(t *testing.T) {
@ -57,6 +58,11 @@ func TestCreate(t *testing.T) {
} }
func TestCreateWithNoGORMPrimayKey(t *testing.T) { func TestCreateWithNoGORMPrimayKey(t *testing.T) {
if dialect := os.Getenv("GORM_DIALECT"); dialect == "mssql" {
t.Skip("Skipping this because MSSQL will return identity only if the table has an Id column")
}
jt := JoinTable{From: 1, To: 2} jt := JoinTable{From: 1, To: 2}
err := DB.Create(&jt).Error err := DB.Create(&jt).Error
if err != nil { if err != nil {