mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
Story#108521790 - domain cahnges_dates_for has valid_to
This commit is contained in:
parent
326f4ad4ee
commit
40d4ed4408
2 changed files with 6 additions and 3 deletions
|
@ -210,7 +210,7 @@ module Legacy
|
|||
|
||||
class << self
|
||||
def changes_dates_for domain_id
|
||||
sql = %Q{SELECT dh.*, valid_from
|
||||
sql = %Q{SELECT dh.*, valid_from, valid_to
|
||||
FROM domain_history dh JOIN history h ON dh.historyid=h.id where dh.id=#{domain_id};}
|
||||
|
||||
hash = {}
|
||||
|
|
|
@ -113,7 +113,10 @@ namespace :import do
|
|||
|
||||
desc 'Import domain history'
|
||||
task history_domains: :environment do
|
||||
parallel_import(Legacy::DomainHistory.uniq.pluck(:id)) do |legacy_domain_id|
|
||||
old_ids = Legacy::DomainHistory.uniq.pluck(:id)
|
||||
old_size = old_ids.size
|
||||
parallel_import(old_ids) do |legacy_domain_id, process_idx|
|
||||
start = Time.now.to_f
|
||||
Domain.transaction do
|
||||
domain = Domain.find_by(legacy_id: legacy_domain_id)
|
||||
version_domain = DomainVersion.where("object->>'legacy_id' = '#{legacy_domain_id}'").select(:item_id).first
|
||||
|
@ -183,8 +186,8 @@ namespace :import do
|
|||
end
|
||||
end
|
||||
end
|
||||
puts "[PID: #{Process.pid}] Legacy Domain #{legacy_domain_id} (#{process_idx}/#{old_size}) finished in #{Time.now.to_f - start}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue