Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Commit 83f368e

Browse files
authored
Cleaning up alembic migration files (#5431)
1 parent 3ab3180 commit 83f368e

File tree

2 files changed

+50
-13
lines changed

2 files changed

+50
-13
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""Fixes automatic generation issues
2+
3+
Revision ID: 928b725d64f6
4+
Revises: 3edb0476365a
5+
Create Date: 2024-11-04 15:55:57.864691
6+
7+
"""
8+
9+
from alembic import op
10+
import sqlalchemy as sa
11+
from sqlalchemy.engine.reflection import Inspector
12+
13+
# revision identifiers, used by Alembic.
14+
revision = "928b725d64f6"
15+
down_revision = "3edb0476365a"
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
conn = op.get_bind()
23+
inspector = Inspector.from_engine(conn)
24+
25+
# Check if the table exists
26+
if "service_incident" in inspector.get_table_names():
27+
op.drop_table("service_incident")
28+
29+
op.alter_column(
30+
"entity", "source", existing_type=sa.BOOLEAN(), type_=sa.String(), existing_nullable=True
31+
)
32+
33+
op.drop_index("ix_entity_search_vector", table_name="entity", postgresql_using="gin")
34+
op.create_index(
35+
"entity_search_vector_idx",
36+
"entity",
37+
["search_vector"],
38+
unique=False,
39+
postgresql_using="gin",
40+
)
41+
op.alter_column("entity_type", "jpath", existing_type=sa.VARCHAR(), nullable=True)
42+
op.drop_column("plugin_instance", "configuration")
43+
op.drop_constraint("project_stable_priority_id_fkey", "project", type_="foreignkey")
44+
# ### end Alembic commands ###
45+
46+
47+
def downgrade():
48+
# ### commands auto generated by Alembic - please adjust! ###
49+
pass
50+
# ### end Alembic commands ###

src/dispatch/signal/models.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ class RuleMode(DispatchEnum):
4848
inactive = "Inactive"
4949

5050

51-
assoc_signal_instance_tags = Table(
52-
"assoc_signal_instance_tags",
53-
Base.metadata,
54-
Column(
55-
"signal_instance_id",
56-
UUID(as_uuid=True),
57-
ForeignKey("signal_instance.id", ondelete="CASCADE"),
58-
),
59-
Column("tag_id", Integer, ForeignKey("tag.id", ondelete="CASCADE")),
60-
PrimaryKeyConstraint("signal_instance_id", "tag_id"),
61-
)
62-
63-
6451
assoc_signal_tags = Table(
6552
"assoc_signal_tags",
6653
Base.metadata,

0 commit comments

Comments
 (0)