From e1d522c6a231d957de0295a91b03040135aaafd3 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Wed, 29 Jul 2026 12:35:44 +0200 Subject: [PATCH] fix: missing notification entity_type/entity_id migration (0063) --- .../0063_notification_entity_fields.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 alembic/versions/0063_notification_entity_fields.py diff --git a/alembic/versions/0063_notification_entity_fields.py b/alembic/versions/0063_notification_entity_fields.py new file mode 100644 index 0000000..3cc87db --- /dev/null +++ b/alembic/versions/0063_notification_entity_fields.py @@ -0,0 +1,28 @@ +"""Add entity_type and entity_id to notifications table. + +Revision ID: 0063 +Revises: 0062 +Create Date: 2026-07-29 + +The notification model has entity_type and entity_id fields but the DB +table was never migrated. This causes INSERT failures. +""" + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects.postgresql import UUID + +revision = "0063" +down_revision = "0062" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.add_column("notifications", sa.Column("entity_type", sa.String(50), nullable=True, index=True)) + op.add_column("notifications", sa.Column("entity_id", UUID(as_uuid=True), nullable=True)) + + +def downgrade() -> None: + op.drop_column("notifications", "entity_id") + op.drop_column("notifications", "entity_type")