-
Notifications
You must be signed in to change notification settings - Fork 49
Cleaning out bad data
Justin Coyne edited this page Jan 27, 2017
·
7 revisions
Then you'll have a bunch of accounts without solr collections. These are not useful. Clean them up with:
Account.where(solr_endpoint_id:nil).each do |account|
Apartment::Tenant.drop(account.tenant)
account.destroy
end
Find the accounts with missing collections and submit CreateSolrCollectionJob for each
accounts_to_create = Account.all.map { |a| a.switch { a unless a.solr_endpoint.ping } }.compact
accounts_to_create.map { |account| CreateSolrCollectionJob.perform_later(account) }
When the jobs have completed each account should have a collection again.