"""add next_payment_attempt_at to order

Revision ID: 9930ccaa979a
Revises: b61be376d0f9
Create Date: 2025-07-16 16:49:19.982730

"""

import sqlalchemy as sa
from alembic import op

# Polar Custom Imports

# revision identifiers, used by Alembic.
revision = "9930ccaa979a"
down_revision = "b61be376d0f9"
branch_labels: tuple[str] | None = None
depends_on: tuple[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "orders",
        sa.Column(
            "next_payment_attempt_at", sa.TIMESTAMP(timezone=True), nullable=True
        ),
    )
    op.create_index(
        op.f("ix_orders_next_payment_attempt_at"),
        "orders",
        ["next_payment_attempt_at"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_orders_next_payment_attempt_at"), table_name="orders")
    op.drop_column("orders", "next_payment_attempt_at")
    # ### end Alembic commands ###
