29 lines
771 B
Python
29 lines
771 B
Python
"""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")
|