about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2020-04-16 15:03:24 +0900
committerGitHub <noreply@github.com>2020-04-16 08:03:24 +0200
commitea200a178e3b94299fe7990b7787e988b5678407 (patch)
tree28fd63caa51a3a3b40496eab48b99c5cdbd46ede /db/migrate
parent3825e1943f3e870ffe967f01d6ca4345d69f1a12 (diff)
Fix migration 20200407202420_migrate_unavailable_inboxes (#13481)
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20200407202420_migrate_unavailable_inboxes.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/db/migrate/20200407202420_migrate_unavailable_inboxes.rb b/db/migrate/20200407202420_migrate_unavailable_inboxes.rb
index 0dce26c6f..92a3acb5d 100644
--- a/db/migrate/20200407202420_migrate_unavailable_inboxes.rb
+++ b/db/migrate/20200407202420_migrate_unavailable_inboxes.rb
@@ -4,8 +4,13 @@ class MigrateUnavailableInboxes < ActiveRecord::Migration[5.2]
   def up
     urls = Redis.current.smembers('unavailable_inboxes')
 
-    urls.each do |url|
-      host = Addressable::URI.parse(url).normalized_host
+    hosts = urls.map do |url|
+      Addressable::URI.parse(url).normalized_host
+    end.compact.uniq
+
+    UnavailableDomain.delete_all
+
+    hosts.each do |host|
       UnavailableDomain.create(domain: host)
     end