"""Remove stripe ID columns

Revision ID: 974ff0719c1d
Revises: 03f24e6aa030
Create Date: 2025-12-16 11:27:52.943581

"""

import sqlalchemy as sa
from alembic import op

# Polar Custom Imports

# revision identifiers, used by Alembic.
revision = "974ff0719c1d"
down_revision = "03f24e6aa030"
branch_labels: tuple[str] | None = None
depends_on: tuple[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_discounts_stripe_coupon_id"), table_name="discounts")
    op.drop_column("discounts", "stripe_coupon_id")
    op.drop_column("product_prices", "stripe_price_id")
    op.drop_index(op.f("ix_products_stripe_product_id"), table_name="products")
    op.drop_column("products", "stripe_product_id")
    op.drop_index(
        op.f("ix_subscriptions_stripe_subscription_id"), table_name="subscriptions"
    )
    op.drop_column("subscriptions", "stripe_subscription_id")
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "subscriptions",
        sa.Column(
            "stripe_subscription_id", sa.VARCHAR(), autoincrement=False, nullable=True
        ),
    )
    op.create_index(
        op.f("ix_subscriptions_stripe_subscription_id"),
        "subscriptions",
        ["stripe_subscription_id"],
        unique=False,
    )
    op.add_column(
        "products",
        sa.Column(
            "stripe_product_id", sa.VARCHAR(), autoincrement=False, nullable=True
        ),
    )
    op.create_index(
        op.f("ix_products_stripe_product_id"),
        "products",
        ["stripe_product_id"],
        unique=False,
    )
    op.add_column(
        "product_prices",
        sa.Column("stripe_price_id", sa.VARCHAR(), autoincrement=False, nullable=True),
    )
    op.add_column(
        "discounts",
        sa.Column("stripe_coupon_id", sa.VARCHAR(), autoincrement=False, nullable=True),
    )
    op.create_index(
        op.f("ix_discounts_stripe_coupon_id"),
        "discounts",
        ["stripe_coupon_id"],
        unique=True,
    )
    # ### end Alembic commands ###
