fix(etl): persist track_downloads.created_at instead of defaulting to now() - #515
Open
rickyrombo wants to merge 1 commit into
Open
fix(etl): persist track_downloads.created_at instead of defaulting to now()#515rickyrombo wants to merge 1 commit into
rickyrombo wants to merge 1 commit into
Conversation
… now() The INSERT omitted created_at, so the column fell back to its CURRENT_TIMESTAMP default. On live indexing that is approximately right; on a genesis replay it stamps every row with the time of the replay. Measured against the 2026-08-07 snapshot: all 76,960 migrated rows carried the same created_at (the replay wall-clock) instead of their real download times, which span 2024-08 to 2026-08. Row counts matched exactly on both sides, so nothing in the existing checks noticed -- parity does not compare created_at. Writes params.BlockTime, which for a migration transaction is the source row's own created_at.
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.
What
trackDownload's INSERT omittedcreated_at, so the column fell back to itsCURRENT_TIMESTAMPdefault.Why it matters
On live indexing the default is approximately right. On a genesis replay it
stamps every row with the time of the replay rather than the time of the
download.
Measured against the 2026-08-07 snapshot:
All 76,960 migrated rows carried one identical timestamp instead of their
real download times, which span 2024-08 to 2026-08.
The distinct-count signature makes the damage clear:
Repeat downloads of the same track by the same user collapsed to a single
timestamp.
Why nothing caught it
Row counts match exactly (76,960 on both sides), and
pkg/etl/paritydoes notcompare
created_atfor this table — itsColumnslist is justuser_id.Fix
Write
params.BlockTime, which for a migration transaction is the source row'sown
created_at.🤖 Generated with Claude Code