Skip to content

Commit

Permalink
Add timezone to timestamp models
Browse files Browse the repository at this point in the history
  • Loading branch information
josecsotomorales committed Mar 14, 2024
1 parent da5bc63 commit 5abe649
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sqlalchemy_utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class SomeModel(Base, Timestamp):
id = sa.Column(sa.Integer, primary_key=True)
"""

created = sa.Column(sa.DateTime, default=datetime.now(timezone.utc), nullable=False)
updated = sa.Column(sa.DateTime, default=datetime.now(timezone.utc), nullable=False)
created = sa.Column(sa.DateTime(timezone=True), default=datetime.now(timezone.utc), nullable=False)
updated = sa.Column(sa.DateTime(timezone=True), default=datetime.now(timezone.utc), nullable=False)


@sa.event.listens_for(Timestamp, 'before_update', propagate=True)
Expand Down

0 comments on commit 5abe649

Please sign in to comment.