2026-07-15 21:13:32 +02:00
|
|
|
"""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
|
|
|
|
|
|
2026-07-15 21:19:08 +02:00
|
|
|
revision = "0018_fix_notif"
|
|
|
|
|
down_revision = "0017_notification_preferences"
|
2026-07-15 21:13:32 +02:00
|
|
|
branch_labels = None
|
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade() -> None:
|
|
|
|
|
# Add missing columns from TimestampMixin and SoftDeleteMixin
|
2026-07-31 18:20:09 +02:00
|
|
|
op.execute("ALTER TABLE notification_preferences ADD COLUMN IF NOT EXISTS created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()")
|
|
|
|
|
op.execute("ALTER TABLE notification_preferences ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ")
|
2026-07-15 21:13:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade() -> None:
|
|
|
|
|
op.drop_column("notification_preferences", "deleted_at")
|
|
|
|
|
op.drop_column("notification_preferences", "created_at")
|