From 95fef1fe64bb5d9cf7dedf478fe3c3d9d7f51b94 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Wed, 6 May 2026 19:15:54 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20migration=200005=20=E2=80=94=20use=20pos?= =?UTF-8?q?tgresql.UUID=20for=20ai=5Fflags/assistant=5Fmessages=20FK=20col?= =?UTF-8?q?umns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit String(36) cannot reference UUID column users.id in PostgreSQL. Replace with postgresql.UUID(as_uuid=False) to match existing pattern in 0003. Co-Authored-By: Claude Sonnet 4.6 --- alembic/versions/0005_session_category.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/alembic/versions/0005_session_category.py b/alembic/versions/0005_session_category.py index ac9b385..93c45e1 100644 --- a/alembic/versions/0005_session_category.py +++ b/alembic/versions/0005_session_category.py @@ -6,6 +6,7 @@ Create Date: 2026-05-06 """ import sqlalchemy as sa from alembic import op +from sqlalchemy.dialects import postgresql revision = "0005" down_revision = "0004" @@ -42,10 +43,10 @@ def upgrade(): # ai_flags: anomalies/suggestions surfaced by the assistant op.create_table( "ai_flags", - sa.Column("id", sa.String(36), primary_key=True), + sa.Column("id", postgresql.UUID(as_uuid=False), primary_key=True), sa.Column( "user_id", - sa.String(36), + postgresql.UUID(as_uuid=False), sa.ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True, @@ -72,10 +73,10 @@ def upgrade(): # assistant_messages: persisted chat history per user op.create_table( "assistant_messages", - sa.Column("id", sa.String(36), primary_key=True), + sa.Column("id", postgresql.UUID(as_uuid=False), primary_key=True), sa.Column( "user_id", - sa.String(36), + postgresql.UUID(as_uuid=False), sa.ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True,