From f0b265e27c5e367327f4d129443bea810e92f4e3 Mon Sep 17 00:00:00 2001 From: Kiran Jonnalagadda Date: Tue, 26 Mar 2024 13:24:31 +0530 Subject: [PATCH] Migrate notification preferences for the notification type --- .../bd377f7c3b3b_update_notification_data.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/migrations/versions/bd377f7c3b3b_update_notification_data.py b/migrations/versions/bd377f7c3b3b_update_notification_data.py index c2fcd2560..768ca9ec1 100644 --- a/migrations/versions/bd377f7c3b3b_update_notification_data.py +++ b/migrations/versions/bd377f7c3b3b_update_notification_data.py @@ -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: @@ -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(