Skip to content

Commit

Permalink
Fixing migration and index name
Browse files Browse the repository at this point in the history
  • Loading branch information
galvana committed Sep 15, 2023
1 parent 0f74db2 commit 91e2532
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""fix message template indexes
Revision ID: 52b2cfd1af47
Revises: f17f92237383
Create Date: 2023-09-15 21:29:23.060892
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "52b2cfd1af47"
down_revision = "f17f92237383"
branch_labels = None
depends_on = None


def upgrade():
op.drop_index("ix_messagingtemplate_id", table_name="messaging_template")
op.drop_index("ix_messagingtemplate_key", table_name="messaging_template")
op.create_index(
op.f("ix_messaging_template_id"), "messaging_template", ["id"], unique=False
)
op.create_index(
op.f("ix_messaging_template_key"), "messaging_template", ["key"], unique=True
)


def downgrade():
op.drop_index(op.f("ix_messaging_template_key"), table_name="messaging_template")
op.drop_index(op.f("ix_messaging_template_id"), table_name="messaging_template")
op.create_index(
"ix_messagingtemplate_key", "messaging_template", ["key"], unique=False
)
op.create_index(
"ix_messagingtemplate_id", "messaging_template", ["id"], unique=False
)
4 changes: 3 additions & 1 deletion src/fides/api/models/system_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def __tablename__(self) -> str:
after = Column(MutableDict.as_mutable(JSONB), nullable=False)

__table_args__ = (
Index("idx_system_history_created_at_system_id", "created_at", "system_id"),
Index(
"idx_plus_system_history_created_at_system_id", "created_at", "system_id"
),
)

@property
Expand Down

0 comments on commit 91e2532

Please sign in to comment.