From 1eb59ace5c0f286b13e6ed0c15a9839cffbd79f9 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