Drop unique constraint on players.name (#347)

This commit is contained in:
Erik Vroon
2023-11-25 12:09:22 +01:00
committed by GitHub
parent b8cedd2a8e
commit 051506a45b
2 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
"""drop unique constraint on players.name
Revision ID: fa53e635f410
Revises: 8bae62f80db7
Create Date: 2023-11-25 11:16:18.683799
"""
from alembic import op
# revision identifiers, used by Alembic.
revision: str | None = 'fa53e635f410'
down_revision: str | None = '8bae62f80db7'
branch_labels: str | None = None
depends_on: str | None = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('ix_players_name', table_name='players')
op.create_index(op.f('ix_players_name'), 'players', ['name'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_players_name'), table_name='players')
op.create_index('ix_players_name', 'players', ['name'], unique=False)
# ### end Alembic commands ###

View File

@@ -134,7 +134,7 @@ players = Table(
'players',
metadata,
Column('id', BigInteger, primary_key=True, index=True),
Column('name', String, nullable=False, index=True, unique=True),
Column('name', String, nullable=False, index=True),
Column('created', DateTimeTZ, nullable=False),
Column('tournament_id', BigInteger, ForeignKey('tournaments.id'), index=True, nullable=False),
Column('elo_score', Float, nullable=False),