PostgreSQL rejects BOOLEAN DEFAULT 0 (DatatypeMismatch: column ... is of type
boolean but default expression is of type integer). Migration 0008
(platform_settings.active) crashed the alembic upgrade run by the entrypoint,
which in turn crash-looped the worker. Migration 0011 (password_reset_tokens.
used) had the same latent bug and would have failed next.
Change the Boolean server_default from text('0') to text('false') in both
migrations and both ORM models so the DDL is valid on both PostgreSQL
(production) and SQLite (local/tests).
Verified: full 0001->0011 chain runs on fresh SQLite; alembic check reports no
drift; backend suite 201 passed.
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
"""Add durable, versioned platform settings with redacted secrets."""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "0008_platform_settings"
|
|
down_revision = "0007_product_resources"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"platform_settings",
|
|
sa.Column("id", sa.String(length=64), nullable=False),
|
|
sa.Column("version", sa.String(length=64), nullable=False),
|
|
sa.Column("settings", sa.JSON(), nullable=True),
|
|
sa.Column("secret_ref", sa.String(length=512), nullable=True),
|
|
sa.Column("updated_by_user_id", sa.String(length=64), nullable=True),
|
|
sa.Column("active", sa.Boolean(), server_default=sa.text("false"), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("version", name="uq_platform_settings_version"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_table("platform_settings")
|