This reverts 2529b51. Not a retreat — a reordering, on the operator's
call, and the better sequence.
The squash's acceptance test (run 4971) found ~130 places where the ORM
models do not describe the deployed schema (#3275), including a
unique=True the database never had and two UNIQUE indexes that exist
only in migrations. Collapsing now would have baked all of that into the
one file a public installer starts from.
So: fix the drift first as ordinary migrations on the intact chain, let
the operator deploy so their database moves to the corrected head, and
only then collapse. The baseline is then generated from reconciled
models and reproduces a schema worth reproducing.
Nothing is lost by reverting. The baseline was never deployed, and
regenerating it after the fixes is strictly better than patching this
copy — it will come out of autogenerate correct rather than needing the
same hand-finishing twice.
74 lines
2.3 KiB
Python
74 lines
2.3 KiB
Python
"""post-text translation via Interpreter (milestone 143) — Post columns + settings
|
|
|
|
Post gains the translated title/description + the detected source language,
|
|
Interpreter engine_version (cache key), and translated_at — filled by the
|
|
translate sweep. ImportSettings gains translation_enabled (OFF by default),
|
|
interpreter_base_url (EMPTY — the operator sets their own, behind a reverse
|
|
proxy), and translation_target_lang (en).
|
|
|
|
Revision ID: 0083
|
|
Revises: 0082
|
|
Create Date: 2026-07-07
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "0083"
|
|
down_revision: Union[str, None] = "0082"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"post", sa.Column("post_title_translated", sa.Text(), nullable=True)
|
|
)
|
|
op.add_column(
|
|
"post", sa.Column("description_translated", sa.Text(), nullable=True)
|
|
)
|
|
op.add_column(
|
|
"post",
|
|
sa.Column("translated_source_lang", sa.String(8), nullable=True),
|
|
)
|
|
op.add_column(
|
|
"post",
|
|
sa.Column("translation_engine_version", sa.String(128), nullable=True),
|
|
)
|
|
op.add_column(
|
|
"post",
|
|
sa.Column("translated_at", sa.DateTime(timezone=True), nullable=True),
|
|
)
|
|
op.add_column(
|
|
"import_settings",
|
|
sa.Column(
|
|
"translation_enabled", sa.Boolean(), nullable=False,
|
|
server_default=sa.text("false"),
|
|
),
|
|
)
|
|
op.add_column(
|
|
"import_settings",
|
|
sa.Column(
|
|
"interpreter_base_url", sa.Text(), nullable=False, server_default="",
|
|
),
|
|
)
|
|
op.add_column(
|
|
"import_settings",
|
|
sa.Column(
|
|
"translation_target_lang", sa.Text(), nullable=False,
|
|
server_default="en",
|
|
),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("import_settings", "translation_target_lang")
|
|
op.drop_column("import_settings", "interpreter_base_url")
|
|
op.drop_column("import_settings", "translation_enabled")
|
|
op.drop_column("post", "translated_at")
|
|
op.drop_column("post", "translation_engine_version")
|
|
op.drop_column("post", "translated_source_lang")
|
|
op.drop_column("post", "description_translated")
|
|
op.drop_column("post", "post_title_translated")
|