dev/core#1093: Bckport Fix to v.5.19 to Add Custom Fields to Logging Tables #15642
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This fix was recently merged to master on this PR #15599.
As a regression issue injected when changing the method used to create custom fields, we need to back-port it into v5.19 rc branch.
We recently ran into problems with direct debit extension due to this change. Basically, if someone has logging enabled, and tries to install the extension, a fatal error will be thrown, complaining about a non-existing field.
Before
The problem happens when a custom field is added via XML file on installation of an extension, logging is turned on, and part of the installation process inserts information on that new field. This happens, because the procedure used to install an extension is something like:
So, if we include any updates on the new custom group tables on Upgrader.php, the trigger will be fired to update the table's corresponding logging table, and fail, as the new fields will not exist on the log table.
After
Fixed by building log table after all fields are added to main table, and resetting the cache mapping tables with its columns before calling fixSchemaDifferences() at the end of extension installation.