fix: migration 0005 — use postgresql.UUID for ai_flags/assistant_messages FK columns

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 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-05-06 19:15:54 +01:00
parent 30764d8998
commit 95fef1fe64

View file

@ -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,