"""widen quotes.symbol to 128 chars to fit Eurostat / ONS path identifiers Revision ID: 0005 Revises: 0004 Create Date: 2026-05-15 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op revision: str = "0005" down_revision: Union[str, None] = "0004" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: # batch_alter_table wraps the ALTER in a copy-and-rename dance for # SQLite (which doesn't support ALTER COLUMN TYPE) while remaining a # plain ALTER on MariaDB / Postgres. Required for `alembic upgrade # head` to work against a fresh SQLite database during local tooling # or test bootstrap. with op.batch_alter_table("quotes") as bop: bop.alter_column( "symbol", existing_type=sa.String(64), type_=sa.String(128), existing_nullable=False, ) def downgrade() -> None: with op.batch_alter_table("quotes") as bop: bop.alter_column( "symbol", existing_type=sa.String(128), type_=sa.String(64), existing_nullable=False, )