Mysql upgrade script from 1.4.3 to 1.5.0 does not work

Steps to reproduce

Steps to reproduce:
1. get a Matterhorn 1.4.3+ mysql database
2. use the mysql upgrade script from 1.4.3_to_1.5.0
3. I get the error:
ERROR 1005 (HY000) at line 4: Can't create table 'matterhorneinsvier.mh_role' (errno: 150)

The table mh_role is renamed to mh_role_tmp with different columns. errno is:
If you re-create a table that was dropped, it must have a definition that conforms to the foreign key constraints referencing it. It must have the right column names and types, and it must have indexes on the referenced keys, as stated earlier. If these are not satisfied, MySQL returns error number 1005 and refers to error 150 in the error message.


Greg Logan
June 19, 2014, 10:36 PM

Urgh, no more fixing scripts by making them into symlinks, ok? It makes finding the source of issues like this very very hard.

, this script was created with commit dfdef443c4e9e8ce5983ad2bc6ce0ce0c05273b5, which is MH-10013's initial commit. I'm going to send this your way since you brought the change in.

Rüdiger Rolf
June 18, 2014, 4:56 PM

Okay the errno 15 only happens on my existing DB. I currently would say it has to to with the data currently within the mh_organization table. But I dont really have a clue.

If I try an empty 1.4.3 mysql DB and use the upgrade script it fails with the errno 121. That was easier to solve. The 1.4.3 db already has a foreign key to mh_organization. Dublicate foreign keys are not allowed so we need to delete these from the temporary tables first before we create the new ones:
ALTER TABLE mh_role_tmp DROP FOREIGN KEY FK_mh_role_organization;
ALTER TABLE mh_user_tmp DROP FOREIGN KEY FK_mh_user_organization;

But this did not solve the problem mentioned above.

Fixed and reviewed
Your pinned fields
Click on the next to a field label to start pinning.


Lukas Rohner


Rüdiger Rolf


Incorrectly Functioning Without Workaround

Tags (folksonomy)