Skip to content

Commit

Permalink
Cleaning up alembic migration files
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 committed Nov 5, 2024
1 parent cea0f45 commit 11108e8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 13 deletions.
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 ###
13 changes: 0 additions & 13 deletions src/dispatch/signal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ class RuleMode(DispatchEnum):
inactive = "Inactive"


assoc_signal_instance_tags = Table(
"assoc_signal_instance_tags",
Base.metadata,
Column(
"signal_instance_id",
UUID(as_uuid=True),
ForeignKey("signal_instance.id", ondelete="CASCADE"),
),
Column("tag_id", Integer, ForeignKey("tag.id", ondelete="CASCADE")),
PrimaryKeyConstraint("signal_instance_id", "tag_id"),
)


assoc_signal_tags = Table(
"assoc_signal_tags",
Base.metadata,
Expand Down

0 comments on commit 11108e8

Please sign in to comment.