(dev/core#174) civicrm_cache - Finish transition from DATETIME to TIMESTAMP #12368
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
v4.7.20 (4387c66) updated the definition of
civicrm_cache
so thatcreated_date
andexpired_date
would default to TIMESTAMP on new deployments. For existing deployments, status-checks and DoctorWhen have been encouraging a transition, but it wasn't mandated, and there was little urgency... becauseexpired_date
was generally ignored, and adhoc TTLs oncreated_date
had generally long windows.However, in v5.4, we'll be using
expired_date
in more important ways (dev/core#174), and we should ensure that these values are handled precisely and consistently.Before
created_date
andexpired_date
are TIMESTAMP.created_date
andexpired_date
may be using DATETIME or TIMESTAMP (depending on the particular history and administrative decisions).After
created_date
andexpired_date
are TIMESTAMPs.Comments
In the interest of full disclosure -- I expect there are scenarios in which having
expired_date
asDATETIME
will lead to bugs in 5.4+, but I haven't empirically proven it. This patch preemptively reduces the number of edge-cases we have to consider in managing cache TTLs.Generally, I'm inclined to view the change as safe because (a) all new deployments since 4.7.20 have been using this schema anyway and (b) nothing in
civicrm-core
has been usingexpired_date
.CC @seamuslee001 (resident expert in timezones). Also, ping @scardinius @systopia. (Grepping
universe
, I foundde.systopia.campaign
does a few direct queries on this table - so maybe you have some thought?)