-
Bug
-
Resolution: Fixed
-
Minor
-
2.0
-
None
-
MySQL 5.1.33
-
MySQL
-
MOODLE_20_STABLE
-
MOODLE_25_STABLE
-
w51_
MDL-21116_m52_reversedel -
Easy
-
I have foreign key constraints defined in an install.xml script for a block I am developing.
When $foreign_keys=true in sql_generator.php this block is correctly installed, along with it's constraints, because the tables are ordered such that any table with a foreign key constraint is installed after the table it is dependant upon.
However, when I uninstall that block the tables are dropped in the same order they were installed, which causes database errors resulting in some tables being left behind after the block is deleted.
e.g. "Cannot delete or update a parent row: a foreign key constraint fails"
As a general policy does it not make more sense for the uninstall function to drop tables from an install.xml script in the reverse order to which they are declared (i.e. drop the last table first and the first table last)?
- will help resolve
-
MDL-30799 META: Enable foreign keys in the database schema
- Open