37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
"""add_description_to_validation_policy
|
|
|
|
Revision ID: 7703bbc038bd
|
|
Revises: c9d8e7f6a5b4
|
|
Create Date: 2026-05-31 21:07:34.291012
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy import inspect
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '7703bbc038bd'
|
|
down_revision: Union[str, Sequence[str], None] = 'c9d8e7f6a5b4'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def _table_exists(table_name: str) -> bool:
|
|
conn = op.get_bind()
|
|
inspector = inspect(conn)
|
|
return table_name in inspector.get_table_names()
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Add description column to validation_policies."""
|
|
if not _table_exists("validation_policies"):
|
|
return
|
|
op.add_column('validation_policies', sa.Column('description', sa.Text(), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Remove description column from validation_policies."""
|
|
op.drop_column('validation_policies', 'description')
|