Skip to content

A platform for community discussion. Free, open, simple.

DEV: follow up on bb8cdf9e, assume no dupe bounce_keys

Sam Saffron413a54e7be22
diff --git a/db/migrate/20190502223613_add_bounce_key_index_on_email_logs.rb b/db/migrate/20190502223613_add_bounce_key_index_on_email_logs.rb
index f7d8493c94c..c0c66f59c0d 100644
--- a/db/migrate/20190502223613_add_bounce_key_index_on_email_logs.rb
+++ b/db/migrate/20190502223613_add_bounce_key_index_on_email_logs.rb
@@ -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