"""add indexes to subscriptions date columns

Revision ID: 4b9bb0cb2d44
Revises: 5b1942f56927
Create Date: 2025-11-21 16:47:07.974735

"""

import sqlalchemy as sa
from alembic import op

# Polar Custom Imports

# revision identifiers, used by Alembic.
revision = "4b9bb0cb2d44"
down_revision = "5b1942f56927"
branch_labels: tuple[str] | None = None
depends_on: tuple[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index(
        op.f("ix_subscriptions_canceled_at"),
        "subscriptions",
        ["canceled_at"],
        unique=False,
    )
    op.create_index(
        op.f("ix_subscriptions_ended_at"), "subscriptions", ["ended_at"], unique=False
    )
    op.create_index(
        op.f("ix_subscriptions_ends_at"), "subscriptions", ["ends_at"], unique=False
    )
    op.create_index(
        op.f("ix_subscriptions_started_at"),
        "subscriptions",
        ["started_at"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_subscriptions_started_at"), table_name="subscriptions")
    op.drop_index(op.f("ix_subscriptions_ends_at"), table_name="subscriptions")
    op.drop_index(op.f("ix_subscriptions_ended_at"), table_name="subscriptions")
    op.drop_index(op.f("ix_subscriptions_canceled_at"), table_name="subscriptions")
    # ### end Alembic commands ###
