diff --git a/app/models/contact.rb b/app/models/contact.rb index 97ae8e1ca..79a0e29c0 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -84,7 +84,7 @@ class Contact < ActiveRecord::Base end def to_s - name + name || '[no name]' end def ident_valid_format? diff --git a/app/models/dnskey.rb b/app/models/dnskey.rb index fbdeb80ec..e3b4c8963 100644 --- a/app/models/dnskey.rb +++ b/app/models/dnskey.rb @@ -73,9 +73,9 @@ class Dnskey < ActiveRecord::Base hex = [domain.name_in_wire_format, flags_hex, protocol_hex, alg_hex, public_key_hex].join bin = self.class.hex_to_bin(hex) - if Setting.ds_algorithm == 1 + if ds_digest_type == 1 self.ds_digest = Digest::SHA1.hexdigest(bin).upcase - elsif Setting.ds_algorithm == 2 + elsif ds_digest_type == 2 self.ds_digest = Digest::SHA256.hexdigest(bin).upcase end end diff --git a/app/models/legacy/domain.rb b/app/models/legacy/domain.rb index ffb72657b..5f9568170 100644 --- a/app/models/legacy/domain.rb +++ b/app/models/legacy/domain.rb @@ -10,5 +10,6 @@ module Legacy has_many :object_states, -> { where('valid_to IS NULL') }, foreign_key: :object_id has_many :dnskeys, foreign_key: :keysetid, primary_key: :keyset has_many :domain_contact_maps, foreign_key: :domainid + has_many :nsset_contact_maps, foreign_key: :nssetid, primary_key: :nsset end end diff --git a/app/models/legacy/domain_contact_map.rb b/app/models/legacy/domain_contact_map.rb index ff7806389..4e645ed7f 100644 --- a/app/models/legacy/domain_contact_map.rb +++ b/app/models/legacy/domain_contact_map.rb @@ -2,6 +2,6 @@ module Legacy class DomainContactMap < Db self.table_name = :domain_contact_map - belongs_to :contact, foreign_key: :contactid, primary_key: :legacy_id, class_name: '::Contact' + # belongs_to :contact, foreign_key: :contactid, primary_key: :legacy_id, class_name: '::Contact' end end diff --git a/app/models/legacy/nsset_contact_map.rb b/app/models/legacy/nsset_contact_map.rb new file mode 100644 index 000000000..f7e0a105b --- /dev/null +++ b/app/models/legacy/nsset_contact_map.rb @@ -0,0 +1,5 @@ +module Legacy + class NssetContactMap < Db + self.table_name = :nsset_contact_map + end +end diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index 419ae4987..eb9e13b29 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -164,6 +164,8 @@ namespace :import do start = Time.now.to_f puts '-----> Importing domains...' + # domain_status_map = {} + domain_columns = [ "name", "registered_at", @@ -255,7 +257,7 @@ namespace :import do x.registrant ] - # domain contacts + # admin contacts x.domain_contact_maps.each do |dc| domain_contacts << [ 'admin', # TODO: Where to get real contact type? @@ -266,6 +268,17 @@ namespace :import do ] end + # tech contacts + x.nsset_contact_maps.each do |dc| + domain_contacts << [ + 'tech', # TODO: Where to get real contact type? + user, + user, + x.id, + dc.contactid + ] + end + # domain statuses x.object_states.each do |state| domain_statuses << [ @@ -304,7 +317,7 @@ namespace :import do key.alg, key.key, 3, # ds_alg - Setting.ds_algorithm, # ds_digest_type + 1, # ds_digest_type /SHA1) user, user, x.id