"""add parent_route_id for route grouping

Revision ID: c3d4e5f6a7b8
Revises: b2c3d4e5f6a7
Create Date: 2026-02-06 12:00:00.000000

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'c3d4e5f6a7b8'
down_revision: Union[str, Sequence[str], None] = 'b2c3d4e5f6a7'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        'routes',
        sa.Column(
            'parent_route_id',
            sa.Integer(),
            sa.ForeignKey('routes.id', ondelete='CASCADE'),
            nullable=True,
            index=True,
        ),
    )


def downgrade() -> None:
    op.drop_column('routes', 'parent_route_id')
