foreignKeysEqual checks if two foreign keys are equal.
(fk1, fk2 *storepb.ForeignKeyMetadata)
| 1064 | |
| 1065 | // foreignKeysEqual checks if two foreign keys are equal. |
| 1066 | func foreignKeysEqual(fk1, fk2 *storepb.ForeignKeyMetadata) bool { |
| 1067 | if fk1.ReferencedSchema != fk2.ReferencedSchema { |
| 1068 | return false |
| 1069 | } |
| 1070 | if fk1.ReferencedTable != fk2.ReferencedTable { |
| 1071 | return false |
| 1072 | } |
| 1073 | if fk1.OnDelete != fk2.OnDelete { |
| 1074 | return false |
| 1075 | } |
| 1076 | if fk1.OnUpdate != fk2.OnUpdate { |
| 1077 | return false |
| 1078 | } |
| 1079 | if fk1.MatchType != fk2.MatchType { |
| 1080 | return false |
| 1081 | } |
| 1082 | if len(fk1.Columns) != len(fk2.Columns) { |
| 1083 | return false |
| 1084 | } |
| 1085 | for i, col := range fk1.Columns { |
| 1086 | if col != fk2.Columns[i] { |
| 1087 | return false |
| 1088 | } |
| 1089 | } |
| 1090 | if len(fk1.ReferencedColumns) != len(fk2.ReferencedColumns) { |
| 1091 | return false |
| 1092 | } |
| 1093 | for i, col := range fk1.ReferencedColumns { |
| 1094 | if col != fk2.ReferencedColumns[i] { |
| 1095 | return false |
| 1096 | } |
| 1097 | } |
| 1098 | return true |
| 1099 | } |
| 1100 | |
| 1101 | // compareCheckConstraints compares two lists of check constraints. |
| 1102 | func compareCheckConstraints(engine storepb.Engine, oldChecks, newChecks []*storepb.CheckConstraintMetadata) []*CheckConstraintDiff { |
no outgoing calls
no test coverage detected