Convert jobs datetime columns to timestamptz on PostgreSQL#14784
Merged
Conversation
Contributor
Build Artifacts
Smoke test screenshot |
rtibbles
requested changes
Jun 4, 2026
Member
rtibbles
left a comment
There was a problem hiding this comment.
The KDP specific mitigation for this seems to be working on staging and develop, so I think this is good to go. Please collapse to a single commit though.
ce9fdc5 to
5e17abf
Compare
Contributor
Author
|
Collapsed to a single commit. |
c3e3386 to
375720a
Compare
Contributor
Author
|
Squashed to a single commit and force-pushed. |
Contributor
Author
|
Squashed to a single commit. |
375720a to
ad55b1f
Compare
rtibbles
approved these changes
Jun 4, 2026
Member
rtibbles
left a comment
There was a problem hiding this comment.
Changes look good, and test coverage gives confidence of the fix.
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.
Summary
On PostgreSQL instances upgraded from the SQLAlchemy job store,
jobsdatetime columns remaintimestamp without time zone. Whenenqueue_lifo()subtracts a microsecond from a storedscheduled_time, it reads a naive datetime and raisesValueError: Must use a timezone aware datetime object for scheduling tasks.The migration converts
scheduled_time,time_created, andtime_updatedtoTIMESTAMP WITH TIME ZONE, usingAT TIME ZONE 'UTC'to preserve existing values as UTC. Theinformation_schemacheck makes it idempotent — columns already tz-aware are untouched.References
Fixes #14783
Upstream stopgap: learningequality/kolibri-data-portal#1100
Reviewer guidance
USING col AT TIME ZONE 'UTC'clause reinterprets all existing naive values as UTC. This holds becauseUSE_TZ=Truewas always active, but worth verifying for any non-standard deployment.pytest kolibri/core/tasks/test/test_migrations.py -v— skipped automatically on SQLite.AI usage
Implemented with Claude Code following a plan based on the issue. Refined from initial draft: batched
information_schemaqueries, addedschema_editor.quote_name()for column names in DDL. Reviewed theAT TIME ZONEbehaviour against PostgreSQL docs.@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?