about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-11-15 04:37:17 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-11-14 20:37:17 +0100
commit20150659e6f084d6c6fb4080d08c4104b8ac0570 (patch)
tree62d0eef7a965d6dd942970cfe4e830bca514c388 /db/migrate
parent8087aa83d414150fd1141d237ae9d7c0366fec8d (diff)
Add uniqueness to block email domains (#5692)
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20171114080328_add_index_domain_to_email_domain_blocks.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/db/migrate/20171114080328_add_index_domain_to_email_domain_blocks.rb b/db/migrate/20171114080328_add_index_domain_to_email_domain_blocks.rb
new file mode 100644
index 000000000..84a341510
--- /dev/null
+++ b/db/migrate/20171114080328_add_index_domain_to_email_domain_blocks.rb
@@ -0,0 +1,8 @@
+class AddIndexDomainToEmailDomainBlocks < ActiveRecord::Migration[5.1]
+  disable_ddl_transaction!
+
+  def change
+    add_index :email_domain_blocks, :domain, algorithm: :concurrently, unique: true
+    change_column_default :email_domain_blocks, :domain, from: nil, to: ''
+  end
+end