Skip to content

Commit

Permalink
Fix for foreign keys with same name to ensure that onupdate and ondel…
Browse files Browse the repository at this point in the history
…ete are correct
  • Loading branch information
danbrad committed Apr 21, 2016
1 parent 8655661 commit 5246901
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion model/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ from INFORMATION_SCHEMA.TABLE_CONSTRAINTS
DELETE_RULE,
fk.is_disabled
from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
inner join sys.foreign_keys fk on rc.CONSTRAINT_NAME = fk.name";
inner join sys.foreign_keys fk on rc.CONSTRAINT_NAME = fk.name and rc.CONSTRAINT_SCHEMA = OBJECT_SCHEMA_NAME(fk.parent_object_id)";
using (var dr = cm.ExecuteReader()) {
while (dr.Read()) {
var fk = FindForeignKey((string) dr["CONSTRAINT_NAME"], (string)dr["TABLE_SCHEMA"]);
Expand Down

0 comments on commit 5246901

Please sign in to comment.