"""Add item_numbers JSONB column to documents table.

Revision ID: 0004
Revises: 0003
Create Date: 2026-03-13

Stores SEC 8-K item numbers (e.g. ["2.02", "9.01"]) from the Oracle API
so the event parser can classify event_type correctly.
"""
from __future__ import annotations

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects.postgresql import JSONB

revision: str = "0004"
down_revision: str | None = "0003"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    op.add_column("documents", sa.Column("item_numbers", JSONB, nullable=True))


def downgrade() -> None:
    op.drop_column("documents", "item_numbers")
