Ignore legacy database columns

Closes #1377
This commit is contained in:
Artur Beljajev 2019-12-15 18:27:01 +02:00
parent 857b35417a
commit f0a7edd6d8
14 changed files with 18 additions and 24 deletions

View file

@ -56,6 +56,8 @@ class Contact < ApplicationRecord
after_save :update_related_whois_records
self.ignored_columns = %w[legacy_id legacy_history_id]
ORG = 'org'
PRIV = 'priv'

View file

@ -22,6 +22,8 @@ class Dnskey < ApplicationRecord
FLAGS = %w(0 256 257) # 256 = ZSK, 257 = KSK
DS_DIGEST_TYPE = [1,2]
self.ignored_columns = %w[legacy_domain_id]
def epp_code_map
{
'2005' => [

View file

@ -169,6 +169,8 @@ class Domain < ApplicationRecord
attr_accessor :registrant_typeahead, :update_me,
:epp_pending_update, :epp_pending_delete, :reserved_pw
self.ignored_columns = %w[legacy_id legacy_registrar_id legacy_registrant_id]
def subordinate_nameservers
nameservers.select { |x| x.hostname.end_with?(name) }
end

View file

@ -8,6 +8,8 @@ class DomainContact < ApplicationRecord
attr_accessor :value_typeahead
self.ignored_columns = %w[legacy_domain_id legacy_contact_id]
def epp_code_map
{
'2302' => [

View file

@ -34,6 +34,8 @@ class Nameserver < ApplicationRecord
delegate :name, to: :domain, prefix: true
self.ignored_columns = %w[legacy_domain_id]
def epp_code_map
{
'2302' => [

View file

@ -46,6 +46,8 @@ class Registrar < ApplicationRecord
RegenerateRegistrarWhoisesJob.enqueue id
end
self.ignored_columns = %w[legacy_id]
class << self
def ordered
order(name: :asc)
@ -194,4 +196,4 @@ class Registrar < ApplicationRecord
def vat_liable_in_foreign_country?
!vat_liable_locally?
end
end
end

View file

@ -8,6 +8,8 @@ class ReservedDomain < ApplicationRecord
alias_attribute :registration_code, :password
self.ignored_columns = %w[legacy_id]
class << self
def pw_for(domain_name)
name_in_ascii = SimpleIDN.to_ascii(domain_name)

View file

@ -5,6 +5,8 @@ class User < ApplicationRecord
attr_accessor :phone
self.ignored_columns = %w[legacy_id]
def id_role_username
"#{self.id}-#{self.class}: #{self.username}"
end

View file

@ -60,9 +60,6 @@ Content-Type: application/json
"period_unit":"y",
"creator_str":null,
"updator_str":null,
"legacy_id":null,
"legacy_registrar_id":null,
"legacy_registrant_id":null,
"outzone_at":"2016-09-24T09:11:14.861Z",
"delete_date":"2016-10-24",
"registrant_verification_asked_at":null,
@ -175,9 +172,6 @@ Content-Type: application/json
"period_unit":"y",
"creator_str":null,
"updator_str":null,
"legacy_id":null,
"legacy_registrar_id":null,
"legacy_registrant_id":null,
"outzone_at":"2016-09-24T09:11:14.861Z",
"delete_date":"2016-10-24",
"registrant_verification_asked_at":null,
@ -282,9 +276,6 @@ Content-Type: application/json
"period_unit":"y",
"creator_str":null,
"updator_str":null,
"legacy_id":null,
"legacy_registrar_id":null,
"legacy_registrant_id":null,
"outzone_at":"2016-09-24T09:11:14.861Z",
"delete_date":"2016-10-24",
"registrant_verification_asked_at":null,

View file

@ -60,9 +60,6 @@ Content-Type: application/json
"period_unit":"y",
"creator_str":null,
"updator_str":null,
"legacy_id":null,
"legacy_registrar_id":null,
"legacy_registrant_id":null,
"outzone_at":"2016-09-24T09:11:14.861Z",
"delete_date":"2016-10-24",
"registrant_verification_asked_at":null,
@ -204,9 +201,6 @@ Content-Type: application/json
"period_unit":"y",
"creator_str":null,
"updator_str":null,
"legacy_id":null,
"legacy_registrar_id":null,
"legacy_registrant_id":null,
"outzone_at":"2016-09-24T09:11:14.861Z",
"delete_date":"2016-10-24",
"registrant_verification_asked_at":null,

View file

@ -50,7 +50,6 @@ Content-Type: application/json
"zip": "11111",
"country_code": "EE",
"state": null,
"legacy_id": null,
"statuses": [
"ok"
],

View file

@ -48,9 +48,6 @@ Content-Type: application/json
"period_unit": "y",
"creator_str": null,
"updator_str": null,
"legacy_id": null,
"legacy_registrar_id": null,
"legacy_registrant_id": null,
"outzone_at": "2016-09-24T09:11:14.861Z",
"delete_date": "2016-10-24",
"registrant_verification_asked_at": null,

View file

@ -32,9 +32,6 @@ module Serializers
period_unit: domain.period_unit,
creator_str: domain.creator_str,
updator_str: domain.updator_str,
legacy_id: domain.legacy_id,
legacy_registrar_id: domain.legacy_registrar_id,
legacy_registrant_id: domain.legacy_registrant_id,
outzone_at: domain.outzone_at,
delete_date: domain.delete_date,
registrant_verification_asked_at: domain.registrant_verification_asked_at,

View file

@ -70,7 +70,7 @@ class SerializersRegistrantApiDomainTest < ActiveSupport::TestCase
def test_other_fields_are_also_present
keys = %i[id name registrar registered_at valid_to created_at updated_at
registrant tech_contacts admin_contacts transfer_code name_dirty name_puny period
period_unit creator_str updator_str legacy_id legacy_registrar_id legacy_registrant_id
period_unit creator_str updator_str
outzone_at delete_date registrant_verification_asked_at
registrant_verification_token pending_json force_delete_date statuses
locked_by_registrant_at status_notes nameservers]