"""Doris migration: add ``custom_content`` JSON column to ``web_parsed_pages``.

Stores arbitrary custom content extracted by the CustomExtractor
(per-seed CSS/JSONPath rules and/or Python plugin classes).

Revision ID: 0009
"""
from __future__ import annotations

from repo_core.migrations.builder import MigrationBuilder
from repo_core.migrations.runner import Migration

VERSION = "0009"


def get_doris_migrations() -> list[Migration]:
    """Return ordered Doris migrations."""
    return [
        Migration(
            version="parsed_page_custom_doris_0001",
            description="Add custom_content JSON column to web_parsed_pages for custom extractor data",
            dialect="doris",
            up=(
                MigrationBuilder("web_parsed_pages", dialect="doris")
                .add_column("custom_content", "JSON", nullable=True)
                .alter_table()
            ),
            down=(
                MigrationBuilder("web_parsed_pages", dialect="doris")
                .drop_column("custom_content")
                .alter_table()
            ),
        ),
    ]
