Skip to content

Commit

Permalink
Migration for new indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Jul 30, 2024
1 parent a62fb1a commit 185fa77
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions lms/migrations/versions/ca27e52b7303_add_missing_indexes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Add missing indexes.
Revision ID: ca27e52b7303
Revises: f8ff7e49cbbf
"""
from alembic import op
import sqlalchemy as sa


revision = "ca27e52b7303"
down_revision = "f8ff7e49cbbf"


def upgrade() -> None:
# CONCURRENTLY can't be used inside a transaction. Finish the current one.
op.execute("COMMIT")

op.create_index(
op.f("ix__assignment_membership_lti_role_id"),
"assignment_membership",
["lti_role_id"],
unique=False,
postgresql_concurrently=True,
)
op.create_index(
op.f("ix__user_h_userid"),
"user",
["h_userid"],
unique=False,
postgresql_concurrently=True,
)


def downgrade() -> None:
op.drop_index(op.f("ix__user_h_userid"), table_name="user")
op.drop_index(
op.f("ix__assignment_membership_lti_role_id"),
table_name="assignment_membership",
)

0 comments on commit 185fa77

Please sign in to comment.