"""Add ``publisher_id`` column to ``codal_statements``.  Revision ID: 0018"""

from __future__ import annotations

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

VERSION = "0018"


def get_postgres_migrations() -> list[Migration]:
    return [
        Migration(
            version="codal_statements_0002",
            description="Add publisher_id column to codal_statements for publisher linking",
            up=(
                MigrationBuilder("codal_statements")
                .add_column("publisher_id", "BIGINT", nullable=True)
                .add_index(["publisher_id"])
                .alter_table()
            ),
            down=(
                MigrationBuilder("codal_statements")
                .drop_column("publisher_id")
                .alter_table()
            ),
        ),
    ]
