feat: add Alembic migration for template_id column on glossaries
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m37s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m37s
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
"""Add template_id column to glossaries table
|
||||||
|
|
||||||
|
Revision ID: e1f2a3b4c5d6
|
||||||
|
Revises: d0e1f2a3b4c5
|
||||||
|
Create Date: 2026-06-01
|
||||||
|
|
||||||
|
Tracks which preset template a glossary was imported from,
|
||||||
|
enabling duplicate prevention on the import endpoint.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
# revision identifiers
|
||||||
|
revision = "e1f2a3b4c5d6"
|
||||||
|
down_revision = "d0e1f2a3b4c5"
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.add_column(
|
||||||
|
"glossaries",
|
||||||
|
sa.Column("template_id", sa.String(50), nullable=True),
|
||||||
|
)
|
||||||
|
op.create_index(
|
||||||
|
"ix_glossaries_template_id",
|
||||||
|
"glossaries",
|
||||||
|
["template_id"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.drop_index("ix_glossaries_template_id", table_name="glossaries")
|
||||||
|
op.drop_column("glossaries", "template_id")
|
||||||
Reference in New Issue
Block a user