Add player_event.has_confirmed
parent
b71926f4f3
commit
67ef999017
|
@ -0,0 +1,38 @@
|
|||
"""Add has_confirmed column
|
||||
|
||||
Revision ID: dcf5ffd0ec73
|
||||
Revises: 2a33f577d655
|
||||
Create Date: 2024-11-25 09:17:26.892047
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dcf5ffd0ec73'
|
||||
down_revision = '2a33f577d655'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('players_events', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('has_confirmed', sa.Boolean(), nullable=False))
|
||||
batch_op.alter_column('player_team_role_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
nullable=True)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('players_events', schema=None) as batch_op:
|
||||
batch_op.alter_column('player_team_role_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
nullable=False)
|
||||
batch_op.drop_column('has_confirmed')
|
||||
|
||||
# ### end Alembic commands ###
|
|
@ -1,6 +1,7 @@
|
|||
from sqlalchemy.orm import mapped_column, relationship
|
||||
from sqlalchemy.orm.attributes import Mapped
|
||||
from sqlalchemy.orm.properties import ForeignKey
|
||||
from sqlalchemy.types import Boolean
|
||||
import app_db
|
||||
|
||||
|
||||
|
@ -9,7 +10,8 @@ class PlayerEvent(app_db.BaseModel):
|
|||
|
||||
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
|
||||
player_id: Mapped[int] = mapped_column(ForeignKey("players.steam_id"), primary_key=True)
|
||||
player_team_role_id: Mapped[int] = mapped_column(ForeignKey("players_teams_roles.id"))
|
||||
player_team_role_id: Mapped[int] = mapped_column(ForeignKey("players_teams_roles.id"), nullable=True)
|
||||
has_confirmed: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
|
||||
event: Mapped["Event"] = relationship("Event", back_populates="players")
|
||||
player: Mapped["Player"] = relationship("Player", back_populates="events")
|
||||
|
|
Loading…
Reference in New Issue