refactor: separate activity occurrence dates from creation dates#791
Open
anonymoususer72041 wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR separates the functional occurrence timestamp of activity records from their technical creation timestamp.
PR #758 made it possible to log activities with a manual date and time, but the manually selected activity timestamp was stored in
activity.date_created. That made the activity timeline behave as intended, but it also changed the meaning ofdate_created: instead of always representing when the database row was created, it could represent when the activity occurred.This PR adds a dedicated
activity.date_occurredcolumn and backfills it from the existingdate_createdvalues so that existing activity timelines keep their current ordering and displayed timestamps after migration.Manual activity dates are now stored in
date_occurred, whiledate_createdis always set toNOW()when a new activity row is inserted. Editing an activity date also updatesdate_occurredinstead of overwritingdate_created.Activity timelines, activity grids, date filters, activity statistics, and latest-activity lookups now use
date_occurredas the functional activity timestamp. Existing output aliases such asdateCreated,dateCreatedSort, andlastActivityare intentionally kept unchanged to avoid unnecessary template and JavaScript changes.This restores
date_createdas the technical record creation timestamp while preserving the user-facing behavior introduced by manual activity dates.