"""initial

Revision ID: b2ee259b4966
Revises:
Create Date: 2025-07-07 15:45:05.882984

"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "b2ee259b4966"
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "multi_key",
        sa.Column("x", sa.JSON(), nullable=True),
        sa.Column("y", sa.JSON(), nullable=True),
    )
    op.create_table(
        "multi_key_unique",
        sa.Column("x", sa.Integer(), nullable=False),
        sa.Column("y", sa.Integer(), nullable=False),
        sa.UniqueConstraint("x", "y"),
    )
    op.create_table(
        "tasks",
        sa.Column("id", sa.String(length=32), nullable=False),
        sa.Column("title", sa.String(length=64), nullable=False),
        sa.Column("created", sa.DateTime(timezone=True), nullable=True),
        sa.Column("done", sa.DateTime(timezone=True), nullable=True),
        sa.Column("severity", sa.Integer(), nullable=True),
        sa.Column("created_by", sa.String(), nullable=False),
        sa.Column("type", sa.Enum("todo", "issue", name="tasktype"), nullable=True),
        sa.Column("unique_title", sa.String(), nullable=True),
        sa.Column("story_points", sa.Numeric(), nullable=True),
        sa.Column("random", sa.String(length=64), nullable=True),
        sa.Column("subtitle", sa.String(length=64), nullable=False),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("unique_title"),
    )
    op.create_table(
        "randoms",
        sa.Column("id", sa.String(length=32), nullable=False),
        sa.Column("randomdate", sa.Date(), nullable=False),
        sa.Column("timestamp", sa.DateTime(timezone=True), nullable=False),
        sa.Column("price", sa.Numeric(precision=100, scale=4), nullable=False),
        sa.Column("tenor", sa.String(length=3), nullable=False),
        sa.Column("tick", sa.Boolean(), nullable=True),
        sa.Column("info", sa.JSON(), nullable=True),
        sa.Column("jsonlist", sa.JSON(), nullable=True),
        sa.Column("task_id", sa.String(length=32), nullable=False),
        sa.ForeignKeyConstraint(["task_id"], ["tasks.id"], ondelete="CASCADE"),
        sa.PrimaryKeyConstraint("id"),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("randoms")
    op.drop_table("tasks")
    op.drop_table("multi_key_unique")
    op.drop_table("multi_key")
    # ### end Alembic commands ###
