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.
This commit is contained in:
Maurice Meyer 2017-03-08 11:23:15 +01:00 committed by Lukas Metzger
parent 5c9f0da3aa
commit 1d7086dc6c

View file

@ -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);