-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path001_create_players_table.py
More file actions
40 lines (31 loc) · 1.2 KB
/
001_create_players_table.py
File metadata and controls
40 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Create players table
Revision ID: 001
Revises:
Create Date: 2026-04-09
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "001"
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
"players",
sa.Column("id", sa.String(length=36), nullable=False),
sa.Column("firstName", sa.String(), nullable=False),
sa.Column("middleName", sa.String(), nullable=True),
sa.Column("lastName", sa.String(), nullable=False),
sa.Column("dateOfBirth", sa.String(), nullable=True),
sa.Column("squadNumber", sa.Integer(), nullable=False),
sa.Column("position", sa.String(), nullable=False),
sa.Column("abbrPosition", sa.String(), nullable=True),
sa.Column("team", sa.String(), nullable=True),
sa.Column("league", sa.String(), nullable=True),
sa.Column("starting11", sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("squadNumber"),
)
def downgrade() -> None:
op.drop_table("players")