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")