fix: add missing created_at and deleted_at columns to notification_preferences
- Remove duplicate updated_at from NotificationPreference model (inherited from TimestampMixin) - Add migration 0018 to add created_at and deleted_at columns - Fixes 500 error on GET /notifications/types and /preferences
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""Fix notification_preferences table: add missing created_at and deleted_at columns.
|
||||
|
||||
Revision ID: 0018
|
||||
Revises: 0017
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision = "0018"
|
||||
down_revision = "0017"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Add missing columns from TimestampMixin and SoftDeleteMixin
|
||||
op.add_column(
|
||||
"notification_preferences",
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()),
|
||||
)
|
||||
op.add_column(
|
||||
"notification_preferences",
|
||||
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("notification_preferences", "deleted_at")
|
||||
op.drop_column("notification_preferences", "created_at")
|
||||
Reference in New Issue
Block a user