"""Add optional parent_path_slug on collection landing pages.

Revision ID: 0045_add_collection_parent_path_slug
Revises: 0044_add_collection_sku_mapping
Create Date: 2026-06-18 18:00:00.000000
"""

from __future__ import annotations

from alembic import op
import sqlalchemy as sa

revision = "0045_add_collection_parent_path_slug"
down_revision = "0044_add_collection_sku_mapping"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column(
        "collection_landing_page",
        sa.Column("parent_path_slug", sa.String(512), nullable=True),
    )
    op.create_index(
        "ix_collection_landing_page_parent_path_slug",
        "collection_landing_page",
        ["parent_path_slug"],
    )


def downgrade() -> None:
    op.drop_index("ix_collection_landing_page_parent_path_slug", table_name="collection_landing_page")
    op.drop_column("collection_landing_page", "parent_path_slug")
