Skip to content

Commit

Permalink
Migrate notification preferences for the notification type
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Mar 26, 2024
1 parent 0f15d6b commit f0b265e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions migrations/versions/bd377f7c3b3b_update_notification_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
sa.column('uuid', sa.Uuid()),
sa.column('project_id', sa.Integer()),
)
notification_preferences = sa.table(
'notification_preferences',
sa.column('notification_type'),
)


def upgrade(engine_name: str = '') -> None:
Expand Down Expand Up @@ -64,12 +68,22 @@ def upgrade_() -> None:
update.c.project_id == project.c.id,
)
)
op.execute(
notification_preferences.update()
.values(notification_type='project_update')
.where(notification_preferences.c.notification_type == 'update_new')
)


def downgrade_() -> None:
"""Downgrade default database."""
# Restore old notification type name, move update UUID from fragment to document,
# and set fragment to None
op.execute(
notification_preferences.update()
.values(notification_type='update_new')
.where(notification_preferences.c.notification_type == 'project_update')
)
op.execute(
notification.update()
.values(
Expand Down

0 comments on commit f0b265e

Please sign in to comment.