fix(#152): match issued_at default to naive column schema#166
Conversation
Coverage Report for CI Build 25058656330Warning No base build found for commit Coverage: 95.115%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
ca6f12f to
a41f62a
Compare
winwinashwin
left a comment
There was a problem hiding this comment.
There are a bunch of test cases where we are passing datetime.now(...) as defaults when creating models for unit tests. Let's also refactor those to make them offset naive?
Also, another minor note - the autolink reference to the issue in the commit message is not getting resolved correctly. Can you fix that? Most likely it's just changing fix(issue#152) -> fix(#152)
Sure Ashwin, let me refactor those tests to make them naive as well. Also thank you, for fixing the PR title issue. Regards, |
a41f62a to
7af4a01
Compare
7af4a01 to
ab22338
Compare
The issued_at column is defined as a timezone-naive DateTime, but its default value (datetime.now(timezone.utc)) was returning a timezone-aware object. While some database drivers silently fix this mismatch for us behind the scenes, stricter ones will immediately crash with a TypeError during inserts. This commit fixes the root problem by explicitly removing the timezone info (.replace(tzinfo=None)) before the value hits the database. This ensures the data perfectly matches the expected column schema, preventing crashes across different environments. A regression test has also been added.
ab22338 to
1a7fe66
Compare
The
issued_atcolumn is defined as a timezone-naiveDateTime, butits default value (
datetime.now(timezone.utc)) was returning atimezone-aware object.
While some database drivers silently fix this mismatch for us behind
the scenes, stricter ones will immediately crash with a
TypeErrorduring inserts.
This commit fixes the root problem by explicitly removing the timezone
info (
.replace(tzinfo=None)) before the value hits the database.This ensures the data perfectly matches the expected column schema,
preventing crashes across different environments. A regression test
has also been added.