From 40ee4c2b1ede6d16f62a4ba71c71a1c36045b350 Mon Sep 17 00:00:00 2001 From: blackcoder87 Date: Wed, 27 Nov 2024 14:57:07 +0100 Subject: [PATCH] Create correct FKCs --- application/modules/user/config/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/modules/user/config/config.php b/application/modules/user/config/config.php index 27c90b1e8..5af9c7f13 100644 --- a/application/modules/user/config/config.php +++ b/application/modules/user/config/config.php @@ -963,10 +963,10 @@ public function getUpdate(string $installedVersion): string $this->db()->query('ALTER TABLE `[prefix]_users_groups` ADD CONSTRAINT `FK_[prefix]_users_groups_[prefix]_users` FOREIGN KEY (`user_id`) REFERENCES `[prefix]_users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE;'); } if (!$this->db()->queryCell("SELECT EXISTS (SELECT 1 FROM information_schema.table_constraints WHERE table_schema='" . $dbname . "' AND table_name='[prefix]_users_groups' AND constraint_name='FK_[prefix]_users_groups_[prefix]_groups');")) { - $this->db()->query('ALTER TABLE `[prefix]_users_groups` ADD CONSTRAINT `FK_[prefix]_users_groups_[prefix]_users` FOREIGN KEY (`user_id`) REFERENCES `[prefix]_users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE;'); + $this->db()->query('ALTER TABLE `[prefix]_users_groups` ADD CONSTRAINT `FK_[prefix]_users_groups_[prefix]_groups` FOREIGN KEY (`group_id`) REFERENCES `[prefix]_groups` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE;'); } if (!$this->db()->queryCell("SELECT EXISTS (SELECT 1 FROM information_schema.table_constraints WHERE table_schema='" . $dbname . "' AND table_name='[prefix]_users_groups' AND constraint_name='FK_[prefix]_groups_access_[prefix]_groups');")) { - $this->db()->query('ALTER TABLE `[prefix]_users_groups` ADD CONSTRAINT `FK_[prefix]_users_groups_[prefix]_users` FOREIGN KEY (`user_id`) REFERENCES `[prefix]_users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE;'); + $this->db()->query('ALTER TABLE `[prefix]_users_groups` ADD CONSTRAINT `FK_[prefix]_groups_access_[prefix]_groups` FOREIGN KEY (`group_id`) REFERENCES `[prefix]_groups` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE;'); } // auth_tokens