Files
gh-christianlouis-docuelevate/migrations/script.py.mako
T
copilot-swe-agent[bot] c7d67031d4 fix: resolve merge conflicts with main branch
Merge origin/main into feature branch, resolving 18 conflicts:
- app/api/__init__.py: add classification_rules_router alongside system_reset_router
- app/config.py: keep system reset settings from main
- app/models.py: keep ClassificationRuleModel alongside main's models
- app/utils/settings_service.py: keep factory reset settings from main
- app/views/__init__.py: keep system_reset_router from main
- tests/conftest.py: add ClassificationRuleModel import
- migrations/env.py: add ClassificationRuleModel import
- .env.demo, docs/*, frontend/*, mobile/*: keep additions from main
- BUILD_DATE, GIT_SHA, RUNTIME_INFO, VERSION, CHANGELOG.md: accept main's version

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-03-17 11:09:39 +00:00

41 lines
1.2 KiB
Mako
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""${message}
Revision ID: ${up_revision}
Revises: ${down_revision | comma,n}
Create Date: ${create_date}
"""
from typing import Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: Union[str, None] = ${repr(down_revision)}
depends_on: Union[str, None] = None
def upgrade() -> None:
"""${message}."""
# Use ``op.batch_alter_table()`` for SQLite compatibility.
# Always check whether the table/column already exists before altering
# to keep migrations idempotent (safe to re-run).
#
# Example add a column only if it is missing:
#
# conn = op.get_bind()
# inspector = sa.inspect(conn)
# if "my_table" in inspector.get_table_names():
# existing = {c["name"] for c in inspector.get_columns("my_table")}
# if "new_col" not in existing:
# with op.batch_alter_table("my_table") as batch_op:
# batch_op.add_column(sa.Column("new_col", sa.String(128), nullable=True))
${upgrades if upgrades else "pass"}
def downgrade() -> None:
"""Reverse ${message}."""
${downgrades if downgrades else "pass"}