Skip to content

Commit 9f27d70

Browse files
joeriakkermanJoeri Akkerman
andauthored
patch has constraint method for sql server driver (#170)
Co-authored-by: Joeri Akkerman <joeri@bendingtherules.nl>
1 parent 35ee3ae commit 9f27d70

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

migrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ func (m Migrator) HasConstraint(value interface{}, name string) bool {
572572
}
573573

574574
return m.DB.Raw(
575-
`SELECT count(*) FROM sys.foreign_keys as F inner join sys.tables as T on F.parent_object_id=T.object_id inner join INFORMATION_SCHEMA.TABLES as I on I.TABLE_NAME = T.name WHERE F.name = ? AND I.TABLE_NAME = ? AND I.TABLE_SCHEMA like ? AND I.TABLE_CATALOG = ?;`,
575+
`SELECT count(*) FROM sys.check_constraints as C inner join sys.tables as T on C.parent_object_id=T.object_id inner join INFORMATION_SCHEMA.TABLES as I on I.TABLE_NAME = T.name WHERE C.name = ? AND I.TABLE_NAME = ? AND I.TABLE_SCHEMA like ? AND I.TABLE_CATALOG = ?;`,
576576
name, tableName, tableSchema, tableCatalog,
577577
).Row().Scan(&count)
578578
})

0 commit comments

Comments
 (0)