"""Add version column to codal_statement_listings.

Revision ID: 0034
"""

from __future__ import annotations

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

VERSION = "0034"


def get_postgres_migrations() -> list[Migration]:
    return [
        Migration(
            version="codal_listings_0002",
            description="Add version column to codal_statement_listings",
            up=(
                MigrationBuilder("codal_statement_listings")
                .add_column("version", "INTEGER", nullable=False, default=1)
                .alter_table()
            ),
            down=(
                MigrationBuilder("codal_statement_listings")
                .drop_column("version")
                .alter_table()
            ),
        ),
    ]
