"""Add Checkout.organization_id

Revision ID: 310d1f7742d7
Revises: aee75623c4bb
Create Date: 2025-10-29 14:06:22.072957

"""

import sqlalchemy as sa
from alembic import op

# Polar Custom Imports

# revision identifiers, used by Alembic.
revision = "310d1f7742d7"
down_revision = "aee75623c4bb"
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("checkouts", sa.Column("organization_id", sa.Uuid(), nullable=True))
    op.create_foreign_key(
        op.f("checkouts_organization_id_fkey"),
        "checkouts",
        "organizations",
        ["organization_id"],
        ["id"],
        ondelete="cascade",
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(
        op.f("checkouts_organization_id_fkey"), "checkouts", type_="foreignkey"
    )
    op.drop_column("checkouts", "organization_id")
    # ### end Alembic commands ###
