From 1d7086dc6c17afe541d83e6694c5f1963e901b7e Mon Sep 17 00:00:00 2001 From: Maurice Meyer Date: Wed, 8 Mar 2017 11:23:15 +0100 Subject: [PATCH] Added drop and readd of foreign key on user ->userid (#33) This fixes the issue that the upgrade seems to work but the change from permissions.user to permissions.userid is not applied because of the foreign key. --- api/upgrade.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/upgrade.php b/api/upgrade.php index dcbcb67..c7ca7ec 100644 --- a/api/upgrade.php +++ b/api/upgrade.php @@ -131,8 +131,11 @@ if(isset($input->action) && $input->action == "requestUpgrade") { } if($currentVersion < 4) { $sql["mysql"] = " + ALTER TABLE permissions DROP FOREIGN KEY permissions_ibfk_2; RENAME TABLE user TO users; ALTER TABLE permissions CHANGE user userid INT(11); + ALTER TABLE permissions + ADD CONSTRAINT permissions_ibfk_2 FOREIGN KEY (userid) REFERENCES users (id) ON DELETE CASCADE; ALTER TABLE users ADD CONSTRAINT UNIQUE KEY user_name_index (name);