added tasks for migrate data and tests

This commit is contained in:
Oleg Hasjanov 2021-07-09 12:09:20 +03:00
parent fb352fb718
commit d260eacc1a
6 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,9 @@
class MigrateBeforeForceDeleteStatusesJob < ApplicationJob
def perform
domains = Domain.where.not(statuses_before_force_delete: nil)
domains.each do |domain|
domain.force_delete_domain_statuses_history = domain.statuses_before_force_delete
domain.save
end
end
end

View file

@ -0,0 +1,9 @@
class MigrateStatusesToDomainHistoryJob < ApplicationJob
def perform
domains = Domain.all.select { |d| !d.locked_by_registrant? }
domains.each do |domain|
domain.admin_store_statuses_history = domain.statuses
domain.save
end
end
end

View file

@ -22,6 +22,10 @@ class Domain < ApplicationRecord
alias_attribute :auth_info, :transfer_code # Old attribute name; for PaperTrail
alias_attribute :registered_at, :created_at
store_accessor :json_statuses_history,
:force_delete_domain_statuses_history,
:admin_store_statuses_history
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
# TODO: most inputs should be trimmed before validatation, probably some global logic?