From 3d3bb3badb55511960ed9b2a29ea67e0f0c3f26c Mon Sep 17 00:00:00 2001 From: Fringg Date: Fri, 6 Mar 2026 16:45:03 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=200021=20=E2=80=94=20drop=20server=5Fdefault=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20=D1=81=D0=BC=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=82=D0=B8=D0=BF=D0=B0=20=D0=BD=D0=B0=20JSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PostgreSQL не может автоматически привести строковый default к типу JSON. Решение: убрать default, сменить тип, затем поставить новый default через raw SQL. --- migrations/alembic/versions/0021_landing_localized_texts.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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',