-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(alembic): add migration to test workflow
This commit needs to be removed, before merging the workflow changes. Signed-off-by: Siddhesh Mhadnak <[email protected]>
- Loading branch information
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
alembic/versions/ca14e3688152_make_datetimes_timezone_aware.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
"""Make datetimes timezone-aware | ||
Revision ID: ca14e3688152 | ||
Revises: 6991bcb18f89 | ||
Create Date: 2024-08-11 14:00:37.225870 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "ca14e3688152" | ||
down_revision = "6991bcb18f89" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column( | ||
"scans", | ||
"queued_at", | ||
existing_type=postgresql.TIMESTAMP(), | ||
type_=sa.DateTime(timezone=True), | ||
existing_nullable=True, | ||
) | ||
op.alter_column( | ||
"scans", | ||
"pending_at", | ||
existing_type=postgresql.TIMESTAMP(), | ||
type_=sa.DateTime(timezone=True), | ||
existing_nullable=True, | ||
) | ||
op.alter_column( | ||
"scans", | ||
"finished_at", | ||
existing_type=postgresql.TIMESTAMP(), | ||
type_=sa.DateTime(timezone=True), | ||
existing_nullable=True, | ||
) | ||
op.alter_column( | ||
"scans", | ||
"reported_at", | ||
existing_type=postgresql.TIMESTAMP(), | ||
type_=sa.DateTime(timezone=True), | ||
existing_nullable=True, | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column( | ||
"scans", | ||
"reported_at", | ||
existing_type=sa.DateTime(timezone=True), | ||
type_=postgresql.TIMESTAMP(), | ||
existing_nullable=True, | ||
) | ||
op.alter_column( | ||
"scans", | ||
"finished_at", | ||
existing_type=sa.DateTime(timezone=True), | ||
type_=postgresql.TIMESTAMP(), | ||
existing_nullable=True, | ||
) | ||
op.alter_column( | ||
"scans", | ||
"pending_at", | ||
existing_type=sa.DateTime(timezone=True), | ||
type_=postgresql.TIMESTAMP(), | ||
existing_nullable=True, | ||
) | ||
op.alter_column( | ||
"scans", | ||
"queued_at", | ||
existing_type=sa.DateTime(timezone=True), | ||
type_=postgresql.TIMESTAMP(), | ||
existing_nullable=True, | ||
) | ||
# ### end Alembic commands ### |