Skip to content
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

Disabled/re-enabled foreign key checks on several migrations to get them to work with MySQL 5.6+ #1451

Merged
merged 6 commits into from
Jul 26, 2016

Conversation

thecoolestguy
Copy link
Member

No description provided.

@jrjohnson
Copy link
Member

I would be more comfortable dropping a re-creating keys. Disabling all keys might get us into trouble with some fringe association. Whereas if we drop and re-create keys it should be clear exactly what is happening.

We should also investigate if doctrine write-locks the table when it is migrating. If not then we should if we are messing with the keys.

$this->addSql('ALTER TABLE session_type ADD CONSTRAINT FK_4AAF5703C32A47EE FOREIGN KEY (school_id) REFERENCES school (school_id)');
$this->addSql('ALTER TABLE curriculum_inventory_sequence_block DROP FOREIGN KEY FK_22E6B6806081C3B0');
$this->addSql('ALTER TABLE curriculum_inventory_sequence_block DROP FOREIGN KEY FK_22E6B680591CC992');
//$this->addSql('ALTER TABLE curriculum_inventory_sequence_block DROP FOREIGN KEY FK_22E6B680DEB52F47');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove all commented out lines of code.

@stopfstedt
Copy link
Member

reviewed and LGTM so far. but, please add the drop/create fkey queries to the respective counterparts in the down() functions as well. thanks!

@thecoolestguy
Copy link
Member Author

thecoolestguy commented Jul 26, 2016

Two upgrade migrations were adjusted in this pull request Version20150826215733.php and Version20160122173943.php.

When migrating up to the most recent version (Version20160122173943), and then attempting to migrate down again, the following exception is thrown:

Migration 20160111222451 failed during Execution. Error This migration cannot be reversed, it would unpublish everything.

  [Doctrine\DBAL\Migrations\IrreversibleMigrationException]
  This migration cannot be reversed, it would unpublish everything.

None of the changes made to Version20160122173943.php fail the downgrade process prior to this point, so there is no need to add new steps to the downgrade migration.

When migrating up to the other version file changed in this pull request (Version20150826215733), and then attempting to migrate down again, the following error is thrown:

Fatal error: Call to undefined method Ilios\Migrations\Version20150805000000::abort() in /Users/hedrick/Documents/projects/ilios/app/Resources/DoctrineMigrations/Version20150805000000.php on line 264

This undefined abort() method is called from the initial migration class Version20150805000000.php

If this abort() method is properly defined/fixed in Version20150805000000.php, the Version20150826215733 downgrade migration process should complete without failing.

@stopfstedt stopfstedt merged commit 36c2ae7 into ilios:master Jul 26, 2016
@stopfstedt stopfstedt removed the ready label Jul 26, 2016
homu added a commit that referenced this pull request Jul 26, 2016
…hecoolestguy

replaced call to non-existent method with one of the same intent that works.

refs #1451 (comment)
@thecoolestguy thecoolestguy deleted the 1449_migration_fk_bug branch September 13, 2016 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants