Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(db): cleaning up alembic migration files #5431

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
mvilanova marked this conversation as resolved.
Show resolved Hide resolved
"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
Loading