Add migration to fix hide_mail attribute again

pull/9874/head
Oliver Günther 3 years ago
parent e54ec53b13
commit fc80232300
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 19
      db/migrate/20211118203332_clean_hide_mail.rb

@ -0,0 +1,19 @@
class CleanHideMail < ActiveRecord::Migration[6.1]
def up
execute <<~SQL.squish
UPDATE user_preferences
SET settings = settings - 'hide_mail' || '{"hide_mail": false}'
WHERE settings ->> 'hide_mail' = '0'
SQL
execute <<~SQL.squish
UPDATE user_preferences
SET settings = settings - 'hide_mail' || '{"hide_mail": true}'
WHERE settings ->> 'hide_mail' = '1'
SQL
end
def down
# Nothing to do
end
end
Loading…
Cancel
Save