Fix upgrade failures from zero value trxn_date
#11745
Merged
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
Some longstanding CiviCRM installations would have upgrade failures going to 4.7.19 or higher with the database error,
This change fixes those values to be
NULL
prior to the query that causes the problem.Before
Certain sites with legacy data (canceled event registrations, potentially among other things, from around 2013) have
trxn_date
values of0000-00-00 00:00:00
in thecivicrm_financial_trxn
table. This is not an allowable value for adatetime
field, and an upgrade step on the way to 4.7.19 will cause the error,After
Before that query executes, all
0000-00-00 00:00:00
values incivicrm_financial_trxn.trxn_date
are set toNULL
. Meanwhile, those values seem to be always also occur in thereceive_date
field of the correspondingcivicrm_contribution
row. The upgrade now sets those values toNULL
as well.Technical Details
This shouldn't affect most users.
Comments
@KarinG @JoeMurray @eileenmcnaughton I suspect this is the legacy of some bug fixed in 4.3 or 4.4, but I couldn't easily find it.
Also, while I believe
NULL
is an improvement over0000-00-00 00:00:00
since it's at least an acceptable value, those rows are now the only ones with null dates. Theoretically, this could cause problems in pages or functions that make use of the dates.