Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove more notification migrations

Oliver Günther1e736cbdf01d
diff --git a/db/migrate/20210701073944_add_digest_setting.rb b/db/migrate/20210701073944_add_digest_setting.rb
index 910066157ef..cfcb97c0731 100644
--- a/db/migrate/20210701073944_add_digest_setting.rb
+++ b/db/migrate/20210701073944_add_digest_setting.rb
@@ -1,34 +1,12 @@
class AddDigestSetting < ActiveRecord::Migration[6.1]
def up
- insert_default_digest_channel
+ # No-op
end
def down
remove_digest_channels
end
- def insert_default_digest_channel
- execute <<~SQL
- INSERT INTO
- notification_settings
- (user_id,
- channel,
- involved,
- mentioned,
- watched)
- SELECT
- id,
- 2,
- true,
- true,
- true
- FROM
- users
- WHERE
- type = 'User'
- SQL
- end
-
# Removes all digest channels. Includes non default channels as those might
# also have been added not by the migration but in the cause of the functionality
# the migration was added for.
diff --git a/db/migrate/20210914065555_cleanup_notifications.rb b/db/migrate/20210914065555_cleanup_notifications.rb
index e1a15b44416..9de1b20ec84 100644
--- a/db/migrate/20210914065555_cleanup_notifications.rb
+++ b/db/migrate/20210914065555_cleanup_notifications.rb
@@ -55,25 +55,6 @@ class CleanupNotifications < ActiveRecord::Migration[6.1]
where: "project_id IS NOT NULL",
name: 'index_notification_settings_unique_project'
end
-
- # Set all channels to ian
- execute <<~SQL.squish
- UPDATE notification_settings SET channel = 0;
- SQL
-
- # Restore notification settings
- execute <<~SQL.squish
- INSERT INTO notification_settings
- (project_id, user_id, channel, watched, involved, mentioned,
- work_package_commented, work_package_created, work_package_processed, work_package_prioritized, work_package_scheduled)
- SELECT project_id, user_id, channel + 1, watched, involved, mentioned,
- work_package_commented, work_package_created, work_package_processed, work_package_prioritized, work_package_scheduled
- FROM notification_settings
- UNION
- SELECT project_id, user_id, channel + 2, watched, involved, mentioned,
- work_package_commented, work_package_created, work_package_processed, work_package_prioritized, work_package_scheduled
- FROM notification_settings;
- SQL
end
# rubocop:enable Metrics/AbcSize
end