"""add ad_session_id to ad feed reward record

Revision ID: ad_feed_reward_session
Revises: coin_reward_phase2
Create Date: 2026-06-09
"""

from __future__ import annotations

from alembic import op
import sqlalchemy as sa


revision = "ad_feed_reward_session"
down_revision = "coin_reward_phase2"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column(
        "ad_feed_reward_record",
        sa.Column("ad_session_id", sa.String(length=64), nullable=True),
    )
    op.create_index(
        op.f("ix_ad_feed_reward_record_ad_session_id"),
        "ad_feed_reward_record",
        ["ad_session_id"],
        unique=False,
    )


def downgrade() -> None:
    op.drop_index(
        op.f("ix_ad_feed_reward_record_ad_session_id"),
        table_name="ad_feed_reward_record",
    )
    op.drop_column("ad_feed_reward_record", "ad_session_id")
