mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 16:39:55 +02:00
Optimize registrars import
This commit is contained in:
parent
7cb0a4bdd3
commit
3149d0731d
1 changed files with 3 additions and 1 deletions
|
@ -6,8 +6,10 @@ namespace :import do
|
|||
# Registrar.where('legacy_id IS NOT NULL').delete_all
|
||||
|
||||
registrars = []
|
||||
existing_ids = Registrar.pluck(:legacy_id)
|
||||
|
||||
Legacy::Registrar.all.each do |x|
|
||||
next if Registrar.exists?(legacy_id: x.id)
|
||||
next if existing_ids.include?(x.id)
|
||||
|
||||
registrars << Registrar.new({
|
||||
name: x.organization.try(:strip).presence || x.name.try(:strip).presence || x.handle.try(:strip).presence,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue