mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-13 09:11:14 -05:00
17 lines
347 B
Ruby
17 lines
347 B
Ruby
|
class FixEmailLogs < ActiveRecord::Migration
|
||
|
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
|