Spaces:
Running
Running
sghorbal commited on
Commit ·
e99662b
1
Parent(s): 3869c24
modify caracteristics entity
Browse files
alembic/versions/1891eeeaa700_modify_caracteristics_entity.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""modify caracteristics entity
|
| 2 |
+
|
| 3 |
+
Revision ID: 1891eeeaa700
|
| 4 |
+
Revises: fc681e60e977
|
| 5 |
+
Create Date: 2025-04-18 13:17:12.332495
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
from typing import Sequence, Union
|
| 9 |
+
|
| 10 |
+
from alembic import op
|
| 11 |
+
import sqlalchemy as sa
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
# revision identifiers, used by Alembic.
|
| 15 |
+
revision: str = '1891eeeaa700'
|
| 16 |
+
down_revision: Union[str, None] = 'fc681e60e977'
|
| 17 |
+
branch_labels: Union[str, Sequence[str], None] = None
|
| 18 |
+
depends_on: Union[str, Sequence[str], None] = None
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def upgrade() -> None:
|
| 22 |
+
"""Upgrade schema."""
|
| 23 |
+
# ### commands auto generated by Alembic - please adjust! ###
|
| 24 |
+
op.add_column('caracteristics', sa.Column('nationality', sa.String(), nullable=True), schema='data')
|
| 25 |
+
op.add_column('caracteristics', sa.Column('last_name', sa.String(), nullable=True), schema='data')
|
| 26 |
+
op.add_column('caracteristics', sa.Column('first_name', sa.String(), nullable=True), schema='data')
|
| 27 |
+
op.add_column('caracteristics', sa.Column('play_hand', sa.String(), nullable=True), schema='data')
|
| 28 |
+
op.add_column('caracteristics', sa.Column('back_hand', sa.Integer(), nullable=True), schema='data')
|
| 29 |
+
op.add_column('caracteristics', sa.Column('height_cm', sa.Integer(), nullable=True), schema='data')
|
| 30 |
+
op.add_column('caracteristics', sa.Column('weight_kg', sa.Integer(), nullable=True), schema='data')
|
| 31 |
+
op.add_column('caracteristics', sa.Column('pro_year', sa.Integer(), nullable=True), schema='data')
|
| 32 |
+
op.drop_column('caracteristics', 'date_turned_pro', schema='data')
|
| 33 |
+
op.drop_column('caracteristics', 'height', schema='data')
|
| 34 |
+
op.drop_column('caracteristics', 'weight', schema='data')
|
| 35 |
+
op.drop_column('caracteristics', 'handedness', schema='data')
|
| 36 |
+
# ### end Alembic commands ###
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def downgrade() -> None:
|
| 40 |
+
"""Downgrade schema."""
|
| 41 |
+
# ### commands auto generated by Alembic - please adjust! ###
|
| 42 |
+
op.add_column('caracteristics', sa.Column('handedness', sa.VARCHAR(), autoincrement=False, nullable=True), schema='data')
|
| 43 |
+
op.add_column('caracteristics', sa.Column('weight', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), schema='data')
|
| 44 |
+
op.add_column('caracteristics', sa.Column('height', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True), schema='data')
|
| 45 |
+
op.add_column('caracteristics', sa.Column('date_turned_pro', sa.VARCHAR(), autoincrement=False, nullable=True), schema='data')
|
| 46 |
+
op.drop_column('caracteristics', 'pro_year', schema='data')
|
| 47 |
+
op.drop_column('caracteristics', 'weight_kg', schema='data')
|
| 48 |
+
op.drop_column('caracteristics', 'height_cm', schema='data')
|
| 49 |
+
op.drop_column('caracteristics', 'back_hand', schema='data')
|
| 50 |
+
op.drop_column('caracteristics', 'play_hand', schema='data')
|
| 51 |
+
op.drop_column('caracteristics', 'first_name', schema='data')
|
| 52 |
+
op.drop_column('caracteristics', 'last_name', schema='data')
|
| 53 |
+
op.drop_column('caracteristics', 'nationality', schema='data')
|
| 54 |
+
# ### end Alembic commands ###
|
src/entity/match.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
from sqlalchemy import Integer, String, DateTime, ForeignKey, UniqueConstraint
|
| 3 |
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
| 4 |
from src.entity.odds import Odds
|
|
|
|
|
|
|
| 1 |
from sqlalchemy import Integer, String, DateTime, ForeignKey, UniqueConstraint
|
| 2 |
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
| 3 |
from src.entity.odds import Odds
|
src/entity/odds.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
from sqlalchemy import String, Float, ForeignKey, UniqueConstraint
|
| 3 |
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
| 4 |
|
|
|
|
|
|
|
| 1 |
from sqlalchemy import String, Float, ForeignKey, UniqueConstraint
|
| 2 |
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
| 3 |
|
src/entity/player.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
|
| 2 |
from datetime import date
|
| 3 |
-
from sqlalchemy import
|
| 4 |
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
| 5 |
from typing import List
|
| 6 |
|
|
@@ -32,11 +32,15 @@ class Caracteristics(Base):
|
|
| 32 |
|
| 33 |
# Caracteristics table columns
|
| 34 |
id: Mapped[int] = mapped_column(primary_key=True)
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
date_of_birth: Mapped[date] = mapped_column(String, nullable=True)
|
| 39 |
-
|
| 40 |
|
| 41 |
fk_player_id: Mapped[int] = mapped_column(ForeignKey("data.player.id", ondelete="CASCADE", name='caracteristics_fk_player_id_fkey'), nullable=False)
|
| 42 |
player: Mapped["Player"] = relationship("Player", back_populates="caracteristics")
|
|
|
|
| 1 |
|
| 2 |
from datetime import date
|
| 3 |
+
from sqlalchemy import Integer, String, ForeignKey
|
| 4 |
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
| 5 |
from typing import List
|
| 6 |
|
|
|
|
| 32 |
|
| 33 |
# Caracteristics table columns
|
| 34 |
id: Mapped[int] = mapped_column(primary_key=True)
|
| 35 |
+
nationality: Mapped[str] = mapped_column(String, nullable=True)
|
| 36 |
+
last_name: Mapped[str] = mapped_column(String, nullable=True)
|
| 37 |
+
first_name: Mapped[str] = mapped_column(String, nullable=True)
|
| 38 |
+
play_hand: Mapped[str] = mapped_column(String, nullable=True)
|
| 39 |
+
back_hand: Mapped[int] = mapped_column(Integer, nullable=True)
|
| 40 |
+
height_cm: Mapped[int] = mapped_column(Integer, nullable=True)
|
| 41 |
+
weight_kg: Mapped[int] = mapped_column(Integer, nullable=True)
|
| 42 |
date_of_birth: Mapped[date] = mapped_column(String, nullable=True)
|
| 43 |
+
pro_year: Mapped[Integer] = mapped_column(Integer, nullable=True)
|
| 44 |
|
| 45 |
fk_player_id: Mapped[int] = mapped_column(ForeignKey("data.player.id", ondelete="CASCADE", name='caracteristics_fk_player_id_fkey'), nullable=False)
|
| 46 |
player: Mapped["Player"] = relationship("Player", back_populates="caracteristics")
|