Re-create index over network column

This commit is contained in:
Spotlight 2024-09-24 13:17:27 -05:00
parent cb5e001613
commit 06745ec069
No known key found for this signature in database
GPG Key ID: 874AA355B3209BDC
2 changed files with 27 additions and 1 deletions

View File

@ -42,7 +42,7 @@ class Friend(Base):
__tablename__ = "friends"
friend_code: Mapped[str] = mapped_column("friend_code", primary_key=True, nullable=False, unique=True)
network: Mapped[NetworkType] = mapped_column("network", NetworkTypeValue())
network: Mapped[NetworkType] = mapped_column("network", NetworkTypeValue(), index=True)
online: Mapped[bool]
title_id: Mapped[str] = mapped_column("title_id", nullable=False)
upd_id: Mapped[str] = mapped_column("upd_id", nullable=False)

View File

@ -0,0 +1,26 @@
"""Re-create index over network column
Revision ID: ed39a1af1115
Revises: f2475122ee84
Create Date: 2024-09-24 11:16:36.100960
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ed39a1af1115'
down_revision = 'f2475122ee84'
branch_labels = None
depends_on = None
def upgrade():
with op.batch_alter_table('friends', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_friends_network'), ['network'], unique=False)
def downgrade():
with op.batch_alter_table('friends', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_friends_network'))