Skip to content

Commit

Permalink
add index on activity_item_histories.activity_id
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaconC committed Jan 23, 2025
1 parent 5e8bd84 commit a74b59c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/apps/activities/db/schemas/activity_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ class ActivityItemHistorySchema(_BaseActivityItemSchema, Base):
activity_id = Column(
ForeignKey("activity_histories.id_version", ondelete="CASCADE"),
nullable=False,
index=True,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""activity_item_history add index
Revision ID: 032d8458aa63
Revises: dc2dd9e195d5
Create Date: 2025-01-22 08:44:42.695477
"""

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "032d8458aa63"
down_revision = "dc2dd9e195d5"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_index(
op.f("ix_activity_item_histories_activity_id"), "activity_item_histories", ["activity_id"], unique=False
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_activity_item_histories_activity_id"), table_name="activity_item_histories")
# ### end Alembic commands ###

0 comments on commit a74b59c

Please sign in to comment.