diff --git a/migrations/alembic/versions/0021_landing_localized_texts.py b/migrations/alembic/versions/0021_landing_localized_texts.py index 61050c3e..0458f39f 100644 --- a/migrations/alembic/versions/0021_landing_localized_texts.py +++ b/migrations/alembic/versions/0021_landing_localized_texts.py @@ -84,14 +84,17 @@ def upgrade() -> None: """) # --- 2. ALTER COLUMN types: String/Text -> JSON --- + # Must drop server_default before type change — PG can't auto-cast defaults + op.alter_column('landing_pages', 'title', server_default=None) op.alter_column( 'landing_pages', 'title', type_=sa.JSON(), postgresql_using='title::jsonb', - server_default='{}', nullable=False, ) + op.execute("ALTER TABLE landing_pages ALTER COLUMN title SET DEFAULT '{}'::jsonb") + op.alter_column( 'landing_pages', 'subtitle',