mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
DEV: follow up on bb8cdf9e, assume no dupe bounce_keys
We may have tons of emails in the email logs, assume none are duplicate hunting for duplication can be very expensive.
This commit is contained in:
parent
ce2c19457a
commit
413a54e7be
@ -1,14 +1,5 @@
|
||||
class AddBounceKeyIndexOnEmailLogs < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
execute <<~SQL
|
||||
DELETE FROM email_logs l
|
||||
WHERE bounce_key IS NOT NULL
|
||||
AND id > (
|
||||
SELECT MIN(id)
|
||||
FROM email_logs l2
|
||||
WHERE l2.bounce_key = l.bounce_key
|
||||
)
|
||||
SQL
|
||||
add_index :email_logs, [:bounce_key], unique: true, where: 'bounce_key IS NOT NULL'
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user