From ea200a178e3b94299fe7990b7787e988b5678407 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Thu, 16 Apr 2020 15:03:24 +0900 Subject: [PATCH] Fix migration 20200407202420_migrate_unavailable_inboxes (#13481) --- db/migrate/20200407202420_migrate_unavailable_inboxes.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/db/migrate/20200407202420_migrate_unavailable_inboxes.rb b/db/migrate/20200407202420_migrate_unavailable_inboxes.rb index 0dce26c6f1..92a3acb5d1 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