Fix migration 20200407202420_migrate_unavailable_inboxes (#13481)
This commit is contained in:
		
							parent
							
								
									3825e1943f
								
							
						
					
					
						commit
						ea200a178e
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
					@ -4,8 +4,13 @@ class MigrateUnavailableInboxes < ActiveRecord::Migration[5.2]
 | 
				
			||||||
  def up
 | 
					  def up
 | 
				
			||||||
    urls = Redis.current.smembers('unavailable_inboxes')
 | 
					    urls = Redis.current.smembers('unavailable_inboxes')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    urls.each do |url|
 | 
					    hosts = urls.map do |url|
 | 
				
			||||||
      host = Addressable::URI.parse(url).normalized_host
 | 
					      Addressable::URI.parse(url).normalized_host
 | 
				
			||||||
 | 
					    end.compact.uniq
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    UnavailableDomain.delete_all
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    hosts.each do |host|
 | 
				
			||||||
      UnavailableDomain.create(domain: host)
 | 
					      UnavailableDomain.create(domain: host)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue