prefer-timestamptz
#
problemWhen Postgres stores a datetime in a timestamp
field, Postgres drops the UTC offset. This means 2019-10-11 21:11:24+02
and 2019-10-11 21:11:24-06
will both be stored as 2019-10-11 21:11:24
in the database, even though they are eight hours apart in time.
#
solutionUse a timestamptz
field to ensure Postgres returns your timestamp with the correct UTC offset.
#
create tableInstead of:
Use:
#
alter tableInstead of:
Use:
#
solution for alembic and sqlalchemyInstead of:
Use: