don't test AddForeignKey on sqlite

This commit is contained in:
Nikola Kovacs 2016-05-21 23:19:41 +02:00
parent ed9cfac496
commit 58ce6153e2
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package gorm_test
import ( import (
"fmt" "fmt"
"os"
"reflect" "reflect"
"sort" "sort"
"testing" "testing"
@ -842,6 +843,10 @@ func TestForeignKey(t *testing.T) {
} }
func TestLongForeignKey(t *testing.T) { func TestLongForeignKey(t *testing.T) {
if dialect := os.Getenv("GORM_DIALECT"); dialect == "" || dialect == "sqlite" {
// sqlite does not support ADD CONSTRAINT in ALTER TABLE
return
}
targetScope := DB.NewScope(&ReallyLongTableNameToTestMySQLNameLengthLimit{}) targetScope := DB.NewScope(&ReallyLongTableNameToTestMySQLNameLengthLimit{})
targetTableName := targetScope.TableName() targetTableName := targetScope.TableName()
modelScope := DB.NewScope(&User{}) modelScope := DB.NewScope(&User{})