-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaning up alembic migration files (#5431)
- Loading branch information
Showing
2 changed files
with
50 additions
and
13 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/dispatch/database/revisions/tenant/versions/2024-11-04_928b725d64f6.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,50 @@ | ||
"""Fixes automatic generation issues | ||
Revision ID: 928b725d64f6 | ||
Revises: 3edb0476365a | ||
Create Date: 2024-11-04 15:55:57.864691 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.engine.reflection import Inspector | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "928b725d64f6" | ||
down_revision = "3edb0476365a" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
conn = op.get_bind() | ||
inspector = Inspector.from_engine(conn) | ||
|
||
# Check if the table exists | ||
if "service_incident" in inspector.get_table_names(): | ||
op.drop_table("service_incident") | ||
|
||
op.alter_column( | ||
"entity", "source", existing_type=sa.BOOLEAN(), type_=sa.String(), existing_nullable=True | ||
) | ||
|
||
op.drop_index("ix_entity_search_vector", table_name="entity", postgresql_using="gin") | ||
op.create_index( | ||
"entity_search_vector_idx", | ||
"entity", | ||
["search_vector"], | ||
unique=False, | ||
postgresql_using="gin", | ||
) | ||
op.alter_column("entity_type", "jpath", existing_type=sa.VARCHAR(), nullable=True) | ||
op.drop_column("plugin_instance", "configuration") | ||
op.drop_constraint("project_stable_priority_id_fkey", "project", type_="foreignkey") | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
pass | ||
# ### end Alembic commands ### |
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