-
Notifications
You must be signed in to change notification settings - Fork 41
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
New restore in 1.30 fails with foreign key constraint error #6838
Comments
I should add that this (test) site has CiviCRM installed, sharing the same database. Is the new backup/restore going to work in that situation? |
Probably not out of the box, but with some settings. Have a look at the code, as there's probably no detailed documentation available, yet: https://github.com/backdrop/backdrop/blob/1.x/core/includes/backup/backup.database.inc#L134 But the settings form isn't fully implemented yet... When you run an update with backup, which doesn't need a backup... what do the backup files look like after that? The directory gets created? What's in it? The restore seems to find them, but they're not usable? |
The Backup functionality currently backs up all tables in the active database (except simpletest tables and the contents of cache tables). Then when running the Restore functionality, it drops each table before creating it again. It sounds like possibly the tables need to dropped in a particular order when foreign keys are in use (Backdrop does not use real MySQL foreign keys, but CiviCRM might). I found a similar issue from Backup and Migrate module here: https://www.drupal.org/project/backup_migrate/issues/1542274, which also seemed to affect CiviCRM users in particular. It looks like they solved the problem by disabling foreign key checks during the restore operation. |
I filed a PR at backdrop/backdrop#5020 It includes the following patches:
The second patch is not necessary to fix this particular issue, but I ran across that same problem while inspecting the header and footer code segments. As both patches are cross-ports from Drupal 7 B&M they both seem safe to include. |
Elaborating a little on how that PR works (theoretically): There is the following line of SQL in the backup SQL file that should disable foreign key checks during restore:
However during restore, the current check of @clarkac1 Could you try applying those changes to your Backdrop installation and see if it fixes the restore capability? |
Hmm... these need to be ported to Backdrop's B&M as well. I'll open an issue there. |
Description of the bug
After running update.php which included the new backup (see https://docs.backdropcms.org/documentation/creating-backups) I tried the restore. The restore failed with the message:
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
This was the only message I could find. The system was still usable and I guess had not been updated.
Steps To Reproduce
Actual behavior
The following message was produced:
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
Expected behavior
System should be restored to prior to the update done in 3. above
Additional information
Add any other information that could help, such as:
The text was updated successfully, but these errors were encountered: