"""v0.13.0-RC2 migration

Revision ID: 4f1a2d63d6dd
Revises: d9a77cb243c8
Create Date: 2025-07-21 13:12:13.397952

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "4f1a2d63d6dd"
down_revision: Union[str, None] = "d9a77cb243c8"
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.add_column("activities", sa.Column("import_info", sa.JSON(), nullable=True))
    op.add_column(
        "activities",
        sa.Column(
            "tracker_manufacturer",
            sa.String(length=250),
            nullable=True,
            comment="Tracker manufacturer (e.g., Garmin, Suunto, Polar)",
        ),
    )
    op.add_column(
        "activities",
        sa.Column(
            "tracker_model",
            sa.String(length=250),
            nullable=True,
            comment="Tracker model (e.g., Forerunner 245, Ambit3 Peak, Vantage V2)",
        ),
    )
    # Add the new entry to the migrations table
    op.execute("""
    INSERT INTO migrations (id, name, description, executed) VALUES
    (4, 'v0.13.0', 'Fix users photo path', false);
    """)
    # ### end Alembic commands ###


def downgrade() -> None:
    # Remove the entry from the migrations table
    op.execute("""
    DELETE FROM migrations 
    WHERE id = 4;
    """)
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("activities", "tracker_model")
    op.drop_column("activities", "tracker_manufacturer")
    op.drop_column("activities", "import_info")
    # ### end Alembic commands ###
