discourse/db/migrate/20160201181320_fix_email_logs.rb
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00

19 lines
383 B
Ruby

# frozen_string_literal: true
class FixEmailLogs < ActiveRecord::Migration[4.2]
def up
execute <<-SQL
UPDATE email_logs
SET user_id = u.id
FROM email_logs el
LEFT JOIN users u ON u.email = el.to_address
WHERE email_logs.id = el.id
AND email_logs.user_id IS NULL
AND NOT email_logs.skipped
SQL
end
def down
end
end