Files
wordsearch/alembic/versions/71016fe57b9d_initial_tables.py
T
Mathew Sir Guest the bestandClaude Opus 4.6 2ee8afe582 feat: add game page frontend with grid, word list, timer, and dual input
Recreates base.html and main.html templates (lost during reset).
Adds game.html with setup UI (category picker, board size slider),
interactive grid table, word list sidebar, text input, click-to-select,
timer, and completion banner. Adds game.js for all frontend logic.
Extends theme.css with game grid and form control styles using the
indigo/coral palette.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-06 22:56:13 -06:00

85 lines
2.8 KiB
Python

"""initial tables
Revision ID: 71016fe57b9d
Revises:
Create Date: 2026-05-06 22:42:01.575740
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "71016fe57b9d"
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:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"categories",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("name", sa.String(length=50), nullable=False),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("name"),
)
op.create_table(
"category_words",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("category_id", sa.Integer(), nullable=False),
sa.Column("word", sa.String(length=20), nullable=False),
sa.ForeignKeyConstraint(
["category_id"],
["categories.id"],
),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("category_id", "word"),
)
op.create_table(
"games",
sa.Column("id", sa.String(length=36), nullable=False),
sa.Column("category_id", sa.Integer(), nullable=False),
sa.Column("board_size", sa.Integer(), nullable=False),
sa.Column("grid", sa.JSON(), nullable=False),
sa.Column("status", sa.String(length=20), nullable=False),
sa.Column("started_at", sa.DateTime(), nullable=False),
sa.Column("completed_at", sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(
["category_id"],
["categories.id"],
),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"words",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("game_id", sa.String(length=36), nullable=False),
sa.Column("text", sa.String(length=20), nullable=False),
sa.Column("start_row", sa.Integer(), nullable=False),
sa.Column("start_col", sa.Integer(), nullable=False),
sa.Column("direction", sa.String(length=2), nullable=False),
sa.Column("found", sa.Boolean(), nullable=False),
sa.Column("found_at", sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(
["game_id"],
["games.id"],
),
sa.PrimaryKeyConstraint("id"),
)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("words")
op.drop_table("games")
op.drop_table("category_words")
op.drop_table("categories")
# ### end Alembic commands ###