-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create cards table, and support cards parsing (#377)
- **Create cards table migration** - **Create cards model** - **In BGA log parser, parse card plays in each move** - **Raise exception if move not set** - **Create card plays table & model, and add migration to populate data from existing logs** - **Add TODO** - **Bind dev postgres, and delete unused imports** - **Remove game cards migration**
- Loading branch information
1 parent
6316117
commit ab3337a
Showing
8 changed files
with
258 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
""" | ||
|
||
import json | ||
import logging | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
39 changes: 39 additions & 0 deletions
39
ark_nova_stats/api/migrations/versions/dc8331e9955b_create_cards_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""create-cards-table | ||
Revision ID: dc8331e9955b | ||
Revises: fef90e3dfd97 | ||
Create Date: 2024-08-12 16:11:42.008947 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.sql.functions import now | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "dc8331e9955b" | ||
down_revision = "fef90e3dfd97" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.create_table( | ||
"cards", | ||
sa.Column("id", sa.Integer, primary_key=True, autoincrement=True), | ||
sa.Column("name", sa.UnicodeText, nullable=False), | ||
sa.Column("bga_id", sa.UnicodeText, nullable=False, unique=True), | ||
sa.Column("created_at", sa.DateTime, default=now, nullable=False), | ||
) | ||
|
||
op.create_index( | ||
"cards_bga_id", | ||
"cards", | ||
["bga_id"], | ||
unique=True, | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index("cards_bga_id", "cards") | ||
op.drop_table("cards") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters