OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/db/migrate/20220106145037_fix_missing_...

19 lines
442 B

class FixMissingNotificationSettings < ActiveRecord::Migration[6.1]
def up
execute <<~SQL.squish
INSERT INTO
notification_settings
(user_id, watched, involved, mentioned)
SELECT
u.id, true, true, true
FROM
users u
WHERE type = 'User'
AND NOT EXISTS (SELECT * FROM notification_settings ns WHERE ns.user_id = u.id)
SQL
end
def down
# No data to revert
end
end