"""add training plan link fields to activities

Revision ID: ab0f6e2939d3
Revises: 79d3444f9d7d
Create Date: 2026-03-16 15:08:33.484799

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'ab0f6e2939d3'
down_revision: Union[str, None] = '79d3444f9d7d'
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('training_plan_id', sa.UUID(), nullable=True))
    op.add_column('activities', sa.Column('plan_week', sa.Integer(), nullable=True))
    op.add_column('activities', sa.Column('plan_day', sa.String(length=20), nullable=True))
    op.create_foreign_key(None, 'activities', 'training_plans', ['training_plan_id'], ['id'])
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'activities', type_='foreignkey')
    op.drop_column('activities', 'plan_day')
    op.drop_column('activities', 'plan_week')
    op.drop_column('activities', 'training_plan_id')
    # ### end Alembic commands ###
