-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Fix Core/Dev 18# where logging fails if the AUTO INCREMENT column is … #11865
Conversation
…not named id and add tests
@seamuslee001 thanks! This bug is a fairly major PITA. I agree with any fix for it. Thanks Mr. Fixit :) |
@jusfreeman are you able to test / review it / assign someone to so we can get it merged? |
@eileenmcnaughton can do after the weekend. |
You don't take weekends off do you? Slacker :-) |
Doing visual code review the logic looks good. |
@seamuslee001 @eileenmcnaughton I was able to verify this patch works for both a CiviCRM 4.7.31 and a CiviCRM 4.6.32 site which had an existing log_civicrm_member_roles_rules table. Without the patch applied and attempting to enable logging, the following error is reported to civicrm.log. Interestingly, logging is still enabled after the error.
After the patch is applied, logging is enabled without error. Patch can be applied to both CiviCRM 4.7 and CiviCRM 4.6. This problem would only impact on Drupal websites which have the CiviCRM member roles sync module enabled and I expect, having upgraded from older versions of CiviCRM. The test environments already had an existing log_civicrm_member_roles_rules table. I tried to set up clean environment but was unable to get the log_civicrm_member_roles_rules table created, trying various methods. Agileware Ref CIVICRM-838 |
@jusfreeman thanks for the review - I'm just having trouble interpretting "The test environments already had an existing log_civicrm_member_roles_rules table. I tried to set up clean environment but was unable to get the log_civicrm_member_roles_rules table created, trying various methods." Does that indicate any reservation about this patch or just a side note? |
No reservations. I could only trigger the issue when the log_civicrm_member_roles_rules table exists in the database. If it is absent, no issue. Just thought it curious that log_civicrm_member_roles_rules table could not be created in a "clean" environment. |
OK - I'm going to merge this based on your testing & the (yay) sensible addition of a unit test. I don't think this would affect that side- issue. Thanks @seamuslee001 @jusfreeman |
…not named id and add tests
Overview
Previously if a table that was captured by the Log table creation regex that named its AUTO INCREMENT column something other than id there would be database errors generated as it tried to reconcile the log table schema with the current schema because it didn't do any proper handling for AUTO INCREMENT columns
Before
DB Errors generated when reconciling schema
After
No DB errors
ping @agileware @eileenmcnaughton @JoeMurray
I think this makes sense the case that showed this up is enabling the civicrm membership role sync and then turning on detailed logging. Then proceeding to do a CiviCRM upgrade and it fails as it tries to reconcile the log tables to the main table and in this function unlike the function that initially creates the tables there was no special handling for AUTO INCREMENT