summaryrefslogtreecommitdiffstats
path: root/tools/scripts/ig-hotfix/foreignkeys.sql
diff options
context:
space:
mode:
Diffstat (limited to 'tools/scripts/ig-hotfix/foreignkeys.sql')
-rw-r--r--tools/scripts/ig-hotfix/foreignkeys.sql8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/scripts/ig-hotfix/foreignkeys.sql b/tools/scripts/ig-hotfix/foreignkeys.sql
index 158a56254d..b5c5389e61 100644
--- a/tools/scripts/ig-hotfix/foreignkeys.sql
+++ b/tools/scripts/ig-hotfix/foreignkeys.sql
@@ -5,5 +5,9 @@ FROM information_schema.table_constraints AS tc
JOIN information_schema.constraint_column_usage AS ccu
ON ccu.constraint_name = tc.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY'
- AND (tc.table_name IN ('main_instance', 'main_instancegroup', 'main_instancegroup_instances')
- OR ccu.table_name IN ('main_instance', 'main_instancegroup', 'main_instancegroup_instances'));
+ AND
+ (tc.table_name IN ('main_instance', 'main_instancegroup', 'main_instancegroup_instances')
+ AND ccu.table_name NOT IN ('main_instance', 'main_instancegroup', 'main_instancegroup_instances'))
+ OR
+ (ccu.table_name IN ('main_instance', 'main_instancegroup', 'main_instancegroup_instances')
+ AND tc.table_name NOT IN ('main_instance', 'main_instancegroup', 'main_instancegroup_instances'));