-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Foreign key error when running DB schema update script #1452
Comments
Several tables are dropped starting on line 648 of the script: https://github.com/ilios/ilios/blob/v3.12.0/app/Resources/updateSchemaFromIlios2toIlios3.sql#L648 DROP TABLE IF EXISTS `group_default_instructor`;
DROP TABLE IF EXISTS `curriculum_inventory_program`;
DROP TABLE IF EXISTS `ilm_session_facet_learner`;
DROP TABLE IF EXISTS `ilm_session_facet_instructor`;
DROP TABLE IF EXISTS `offering_instructor`;
DROP TABLE IF EXISTS `offering_learner`;
DROP TABLE IF EXISTS `report_po_value`;
DROP TABLE IF EXISTS `group_x_group`; Of these tables, only I was able to work around the problem reported in this issue by dropping these tables (except Perhaps moving the |
We've recently noticed a few issues like this surfacing when people run the migrations, and for many the issue seems to be that they are using MySQL 5.6 which has changed the way it handles schema updates on columns that are part of a Foreign Key Constraint (see issue #1449 for more info about this 'feature change' in MySQL). Not sure why you experienced the issue with MySQL 5.1 or why you are having the additional problems you listed, but we will look into it. That being said, we've had 100% success running https://github.com/ilios/ilios/blob/v3.12.0/app/Resources/updateSchemaFromIlios2toIlios3.sql for upgrades as recently as yesterday, and had no errors with that part at all, so there may be some data values in your db that are missing or something that may be causing the problem. You are definitely running the file from the 3.12.0 branch, correct? |
I'm definitely running the file from the 3.12.0 branch. And I saw the error occur with both MySQL 5.1 and 5.6 (I don't have immediate access to try other versions in between). I realized it may be an atypical case having the I'm not sure of the exact history of why this table (and the others mentioned above) is present in our DB, but the schema update script does drop this table and the others. |
I'm going to attempt to move the drop table stuff up further in the script and see if that breaks anything else. Seems like this is easily doable and should present no problems. |
I agree that should be a good approach. |
Move drop tables further up in update script This resolves some conflicts which result from FK references in some versions of mysql (5.1, 5.6). Fixes #1452
I encountered this error when trying to run the
updateSchemaFromIlios2toIlios3.sql
script (per the upgrade instructions) to upgrade from 2.4.8 to 3.12.0.I first attempted this using a DB copy on MySQL 5.1, then then same error occurred with 5.6.
I believe a similar error occurs for other tables that are subsequently dropped.
The text was updated successfully, but these errors were encountered: