From 7a7b2f988196761e805e57a55db78ffc0b5400a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 22 Apr 2020 11:00:06 +0300 Subject: [PATCH 01/43] Create scaffold for domain disputes --- app/controllers/admin/disputes_controller.rb | 66 ++++++++++++++++++ app/models/ability.rb | 1 + app/models/dispute.rb | 5 ++ app/views/admin/base/_menu.haml | 3 +- app/views/admin/disputes/_form.html.erb | 58 ++++++++++++++++ app/views/admin/disputes/edit.haml | 3 + app/views/admin/disputes/index.haml | 72 ++++++++++++++++++++ app/views/admin/disputes/new.haml | 3 + config/locales/admin/disputes.en.yml | 10 +++ config/locales/admin/menu.en.yml | 1 + config/locales/en.yml | 1 + config/routes.rb | 2 + db/migrate/20200421093637_create_disputes.rb | 14 ++++ 13 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 app/controllers/admin/disputes_controller.rb create mode 100644 app/models/dispute.rb create mode 100644 app/views/admin/disputes/_form.html.erb create mode 100644 app/views/admin/disputes/edit.haml create mode 100644 app/views/admin/disputes/index.haml create mode 100644 app/views/admin/disputes/new.haml create mode 100644 config/locales/admin/disputes.en.yml create mode 100644 db/migrate/20200421093637_create_disputes.rb diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb new file mode 100644 index 000000000..8061eb890 --- /dev/null +++ b/app/controllers/admin/disputes_controller.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module Admin + class DisputesController < BaseController + load_and_authorize_resource + before_action :set_dispute, only: %i[show edit update destroy] + + # GET /admin/disputes + def index + params[:q] ||= {} + disputes = Dispute.all.order(:domain_name) + @q = disputes.search(params[:q]) + @disputes = @q.result.page(params[:page]) + @disputes = @disputes.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? + end + + # GET /admin/disputes/1 + def show; end + + # GET /admin/disputes/new + def new + @dispute = Dispute.new + end + + # GET /admin/disputes/1/edit + def edit; end + + # POST /admin/disputes + def create + @dispute = Dispute.new(dispute_params) + + if @dispute.save + redirect_to @dispute, notice: 'Dispute was successfully created.' + else + render :new + end + end + + # PATCH/PUT /admin/disputes/1 + def update + if @dispute.update(dispute_params) + redirect_to @dispute, notice: 'Dispute was successfully updated.' + else + render :edit + end + end + + # DELETE /admin/disputes/1 + def destroy + @dispute.destroy + redirect_to disputes_url, notice: 'Dispute was successfully destroyed.' + end + + private + + # Use callbacks to share common setup or constraints between actions. + def set_dispute + @dispute = Dispute.find(params[:id]) + end + + # Only allow a trusted parameter "white list" through. + def dispute_params + params.require(:dispute).permit(:domain_name, :password, :expires_at, :comment, :created_at) + end + end +end diff --git a/app/models/ability.rb b/app/models/ability.rb index a727254ad..0e18f433a 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -100,6 +100,7 @@ class Ability can :manage, Invoice can :manage, WhiteIp can :manage, AccountActivity + can :manage, Dispute can :read, ApiLog::EppLog can :read, ApiLog::ReppLog can :update, :pending diff --git a/app/models/dispute.rb b/app/models/dispute.rb new file mode 100644 index 000000000..874e46b30 --- /dev/null +++ b/app/models/dispute.rb @@ -0,0 +1,5 @@ +class Dispute < ApplicationRecord + validates :domain_name, :password, :starts_at, :expires_at, :comment, + presence: true + validates_uniqueness_of :domain_name, case_sensitive: true +end diff --git a/app/views/admin/base/_menu.haml b/app/views/admin/base/_menu.haml index fa1b50440..a327419fd 100644 --- a/app/views/admin/base/_menu.haml +++ b/app/views/admin/base/_menu.haml @@ -32,10 +32,11 @@ %li= link_to t('.zones'), admin_zones_path %li= link_to t('.blocked_domains'), admin_blocked_domains_path %li= link_to t('.reserved_domains'), admin_reserved_domains_path + %li= link_to t('.disputed_domains'), admin_disputes_path %li= link_to t('.epp_log'), admin_epp_logs_path(created_after: 'today') %li= link_to t('.repp_log'), admin_repp_logs_path(created_after: 'today') %li= link_to t('.que'), '/admin/que' %ul.nav.navbar-nav.navbar-right %li= link_to t('.sign_out'), destroy_admin_user_session_path, method: :delete, - class: 'navbar-link' \ No newline at end of file + class: 'navbar-link' diff --git a/app/views/admin/disputes/_form.html.erb b/app/views/admin/disputes/_form.html.erb new file mode 100644 index 000000000..a234c17bc --- /dev/null +++ b/app/views/admin/disputes/_form.html.erb @@ -0,0 +1,58 @@ +<%= form_for([:admin, @dispute], html: { class: 'form-horizontal' }) do |f| %> + <%= render 'shared/full_errors', object: @dispute %> + +
+
+
+
+
+ <%= t(:general) %> +
+
+
+
+
+ <%= f.label :domain_name %> +
+
+ <%= f.text_field(:domain_name, class: 'form-control', disabled: !f.object.new_record?) %> +
+
+
+
+ <%= f.label :password %> +
+
+ <%= f.text_field(:password, placeholder: t(:optional), class: 'form-control') %> + <%= t '.password_hint' %> +
+
+
+
+ <%= f.label :starts_at %> +
+
+ <%= f.text_field(:starts_at, placeholder: t(:optional), class: 'form-control') %> + <%= t '.password_hint' %> +
+
+
+
+ <%= f.label :expires_at %> +
+
+ <%= f.text_field(:expires_at, placeholder: t(:optional), class: 'form-control') %> + <%= t '.password_hint' %> +
+
+
+
+
+
+ +
+
+ <%= button_tag(t(:save), class: 'btn btn-primary') %> +
+
+<% end %> diff --git a/app/views/admin/disputes/edit.haml b/app/views/admin/disputes/edit.haml new file mode 100644 index 000000000..51d77f0cc --- /dev/null +++ b/app/views/admin/disputes/edit.haml @@ -0,0 +1,3 @@ += render 'shared/title', name: t(:edit_pw) + += render 'form' diff --git a/app/views/admin/disputes/index.haml b/app/views/admin/disputes/index.haml new file mode 100644 index 000000000..63438ad9e --- /dev/null +++ b/app/views/admin/disputes/index.haml @@ -0,0 +1,72 @@ +- content_for :actions do + = link_to(t('.new_btn'), new_admin_dispute_path, class: 'btn btn-primary') += render 'shared/title', name: t('.title') + +.row + .col-md-12 + = search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f| + .row + .col-md-3 + .form-group + = f.label :name + = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) + .col-md-3 + .form-group + = f.label t(:created_at_from) + = f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_at_from) + .col-md-3 + .form-group + = f.label t(:created_at_until) + = f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_at_until) + .row + .col-md-3 + .form-group + = label_tag t(:results_per_page) + = text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) + .col-md-3{style: 'padding-top: 25px;'} + %button.btn.btn-primary +   + %span.glyphicon.glyphicon-search +   + = link_to(t('.reset_btn'), admin_disputes_path, class: 'btn btn-default') +%hr +.row + .col-md-12 + .table-responsive + %table.table.table-hover.table-bordered.table-condensed + %thead + %tr + %th{class: 'col-xs-2'} + = sort_link(@q, 'name') + %th{class: 'col-xs-2'} + = sort_link(@q, 'password') + %th{class: 'col-xs-2'} + = sort_link(@q, 'expires_at') + %th{class: 'col-xs-2'} + = sort_link(@q, 'comment') + %th{class: 'col-xs-2'} + = sort_link(@q, 'created_at', t(:created_at)) + %th{class: 'col-xs-2'} + = sort_link(@q, 'updated_at', t(:updated_at)) + %th{class: 'col-xs-2'} + = t(:actions) + %tbody + - @disputes.each do |x| + %tr + %td= x.domain_name + %td= x.password + %td= x.expires_at + %td= x.comment + %td= l(x.created_at, format: :short) + %td= l(x.updated_at, format: :short) + %td + = link_to(t(:edit_pw), edit_admin_dispute_path(id: x.id), + class: 'btn btn-primary btn-xs') + = link_to(t(:delete), delete_admin_dispute_path(id: x.id), + data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') +.row + .col-md-6 + = paginate @disputes + .col-md-6.text-right + .pagination + = t(:result_count, count: @disputes.total_count) diff --git a/app/views/admin/disputes/new.haml b/app/views/admin/disputes/new.haml new file mode 100644 index 000000000..0a57af7be --- /dev/null +++ b/app/views/admin/disputes/new.haml @@ -0,0 +1,3 @@ += render 'shared/title', name: t(:add_disputed_domain) + += render 'form' diff --git a/config/locales/admin/disputes.en.yml b/config/locales/admin/disputes.en.yml new file mode 100644 index 000000000..4073d6e61 --- /dev/null +++ b/config/locales/admin/disputes.en.yml @@ -0,0 +1,10 @@ +en: + admin: + disputes: + index: + title: Domain disputes + new_btn: New domain dispute + reset_btn: Reset + + form: + password_hint: Generated automatically if left blank diff --git a/config/locales/admin/menu.en.yml b/config/locales/admin/menu.en.yml index 2c31a5193..1cb396ed6 100644 --- a/config/locales/admin/menu.en.yml +++ b/config/locales/admin/menu.en.yml @@ -13,6 +13,7 @@ en: zones: Zones blocked_domains: Blocked domains reserved_domains: Reserved domains + disputed_domains: Domain disputes epp_log: EPP log repp_log: REPP log que: Que diff --git a/config/locales/en.yml b/config/locales/en.yml index cf72b1027..f1d2ad817 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -629,6 +629,7 @@ en: available_verification_url_not_found: 'Available verification url not found, for domain.' add_reserved_domain: 'Add domain to reserved list' add_blocked_domain: 'Add domain to blocked list' + add_disputed_domain: 'Add domain to disputed list' edit_pw: 'Edit Pw' optional: 'Optional' test_registrar: "Test registrar" diff --git a/config/routes.rb b/config/routes.rb index 53d78dfa9..0d2093d36 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,7 @@ require_dependency 'epp_constraint' Rails.application.routes.draw do + resources :disputes # https://github.com/internetee/epp_proxy#translation-of-epp-calls namespace :epp do constraints(EppConstraint.new(:session)) do @@ -258,6 +259,7 @@ Rails.application.routes.draw do get 'delete' end end + resources :disputes resources :registrars do resources :api_users, except: %i[index] diff --git a/db/migrate/20200421093637_create_disputes.rb b/db/migrate/20200421093637_create_disputes.rb new file mode 100644 index 000000000..48cdfae59 --- /dev/null +++ b/db/migrate/20200421093637_create_disputes.rb @@ -0,0 +1,14 @@ +class CreateDisputes < ActiveRecord::Migration[5.2] + def change + create_table :disputes do |t| + t.string :domain_name + t.string :password + t.date :expires_at + t.date :starts_at + t.text :comment + t.datetime :created_at + + t.timestamps + end + end +end From 0f2a290d647997d9d8541a1bb9657dd308ad81dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 24 Apr 2020 16:04:58 +0300 Subject: [PATCH 02/43] Add disputing logic for EPP --- app/controllers/admin/disputes_controller.rb | 11 +- app/controllers/epp/domains_controller.rb | 4 + .../domain_update_confirms_controller.rb | 6 + app/jobs/update_whois_record_job.rb | 19 +- app/models/dispute.rb | 88 ++- app/models/dns/domain_name.rb | 6 +- app/models/domain.rb | 8 +- app/models/epp/domain.rb | 22 +- app/models/setting.rb | 1 + config/app.yml | 2 + config/locales/admin/disputes.en.yml | 2 + config/locales/en.yml | 3 + config/routes.rb | 7 +- db/migrate/20200421093637_create_disputes.rb | 10 +- db/structure.sql | 746 +++++++++++------- lib/schemas/eis-1.0.xsd | 11 + lib/tasks/whois.rake | 5 + 17 files changed, 626 insertions(+), 325 deletions(-) diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 8061eb890..8d26db614 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -28,9 +28,8 @@ module Admin # POST /admin/disputes def create @dispute = Dispute.new(dispute_params) - if @dispute.save - redirect_to @dispute, notice: 'Dispute was successfully created.' + redirect_to admin_disputes_url, notice: 'Dispute was successfully created.' else render :new end @@ -39,16 +38,16 @@ module Admin # PATCH/PUT /admin/disputes/1 def update if @dispute.update(dispute_params) - redirect_to @dispute, notice: 'Dispute was successfully updated.' + redirect_to admin_disputes_url, notice: 'Dispute was successfully updated.' else render :edit end end # DELETE /admin/disputes/1 - def destroy + def delete @dispute.destroy - redirect_to disputes_url, notice: 'Dispute was successfully destroyed.' + redirect_to admin_disputes_url, notice: 'Dispute was successfully destroyed.' end private @@ -60,7 +59,7 @@ module Admin # Only allow a trusted parameter "white list" through. def dispute_params - params.require(:dispute).permit(:domain_name, :password, :expires_at, :comment, :created_at) + params.require(:dispute).permit(:domain_name, :password, :starts_at, :comment) end end end diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 9e4f6123a..2ab1f6d3a 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -104,6 +104,10 @@ module Epp authorize! :update, @domain, @password if @domain.update(params[:parsed_frame], current_user) + if @domain.disputed? + dispute = Dispute.active.find_by(domain_name: @domain.name) + dispute.close + end if @domain.epp_pending_update.present? render_epp_response '/epp/domains/success_pending' else diff --git a/app/controllers/registrant/domain_update_confirms_controller.rb b/app/controllers/registrant/domain_update_confirms_controller.rb index 61e623ddf..83b7ee953 100644 --- a/app/controllers/registrant/domain_update_confirms_controller.rb +++ b/app/controllers/registrant/domain_update_confirms_controller.rb @@ -31,6 +31,12 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController end elsif params[:confirmed] if @registrant_verification.domain_registrant_change_confirm!("email link, #{initiator}") + if @domain.disputed? + Rails.logger.info 'Closing domain dispute via RegistrantConfirmation' + dispute = Dispute.active.find_by(domain_name: @domain.name) + dispute.close + end + flash[:notice] = t(:registrant_domain_verification_confirmed) redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true) else diff --git a/app/jobs/update_whois_record_job.rb b/app/jobs/update_whois_record_job.rb index bee0e032c..cd35823e6 100644 --- a/app/jobs/update_whois_record_job.rb +++ b/app/jobs/update_whois_record_job.rb @@ -4,10 +4,11 @@ class UpdateWhoisRecordJob < Que::Job ::PaperTrail.whodunnit = "job - #{self.class.name} - #{type}" klass = case type - when 'reserved'then ReservedDomain - when 'blocked' then BlockedDomain - when 'domain' then Domain - end + when 'reserved' then ReservedDomain + when 'blocked' then BlockedDomain + when 'domain' then Domain + when 'disputed' then Dispute + end Array(names).each do |name| record = klass.find_by(name: name) @@ -19,8 +20,6 @@ class UpdateWhoisRecordJob < Que::Job end end - - def update_domain(domain) domain.whois_record ? domain.whois_record.save : domain.create_whois_record end @@ -33,6 +32,9 @@ class UpdateWhoisRecordJob < Que::Job update_reserved(record) end + def update_disputed(record) + update_reserved(record) + end # 1. deleting own # 2. trying to regenerate reserved in order domain is still in the list @@ -41,6 +43,7 @@ class UpdateWhoisRecordJob < Que::Job BlockedDomain.find_by(name: name).try(:generate_data) ReservedDomain.find_by(name: name).try(:generate_data) + Dispute.active.find_by(domain_name: name).try(:generate_data) end def delete_reserved(name) @@ -51,4 +54,8 @@ class UpdateWhoisRecordJob < Que::Job def delete_blocked(name) delete_reserved(name) end + + def delete_disputed(name) + delete_reserved(name) + end end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 874e46b30..450a92a2b 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -1,5 +1,89 @@ +# frozen_string_literal: true + class Dispute < ApplicationRecord - validates :domain_name, :password, :starts_at, :expires_at, :comment, - presence: true + validates :domain_name, :password, :starts_at, :expires_at, presence: true validates_uniqueness_of :domain_name, case_sensitive: true + before_validation :fill_empty_passwords + before_validation :set_expiry_date + validate :validate_domain_name + + with_options on: :admin do + validate :validate_start_date + end + before_save :set_expiry_date + before_save :sync_reserved_password + after_destroy :remove_data + + scope :expired, -> { where('expires_at < ?', Time.zone.today) } + scope :active, -> { where('expires_at > ? AND closed = 0', Time.zone.today) } + scope :closed, -> { where(closed: true) } + + alias_attribute :name, :domain_name + + def set_expiry_date + return if starts_at.blank? + + self.expires_at = starts_at + Setting.dispute_period_in_months.months + end + + def generate_password + self.password = SecureRandom.hex + end + + def generate_data + return if Domain.where(name: domain_name).any? + + wr = Whois::Record.find_or_initialize_by(name: domain_name) + wr.json = @json = generate_json # we need @json to bind to class + wr.save + end + + def close + self.closed = true + save! + end + + def generate_json + h = HashWithIndifferentAccess.new + h[:name] = domain_name + h[:status] = ['Disputed'] + h + end + + def remove_data + UpdateWhoisRecordJob.enqueue domain_name, 'disputed' + end + + def fill_empty_passwords + generate_password if password.blank? + end + + def sync_reserved_password + reserved_domain = ReservedDomain.find_by(name: domain_name) + generate_password if password.blank? + + unless reserved_domain.nil? + reserved_domain.password = password + reserved_domain.save! + end + + generate_data + end + + private + + def validate_start_date + return if starts_at.nil? + + errors.add(:starts_at, :past) if starts_at.past? + end + + def validate_domain_name + return unless domain_name + + zone = domain_name.split('.').last + supported_zone = DNS::Zone.origins.include?(zone) + + errors.add(:domain_name, :unsupported_zone) unless supported_zone + end end diff --git a/app/models/dns/domain_name.rb b/app/models/dns/domain_name.rb index e4dd24fa5..c1af4d5e7 100644 --- a/app/models/dns/domain_name.rb +++ b/app/models/dns/domain_name.rb @@ -68,6 +68,10 @@ module DNS ReservedDomain.where(name: name).any? end + def disputed? + Dispute.active.where(domain_name: name).any? + end + def auctionable? !not_auctionable? end @@ -81,7 +85,7 @@ module DNS attr_reader :name def not_auctionable? - blocked? || reserved? + blocked? || reserved? || disputed? end def zone_with_same_origin? diff --git a/app/models/domain.rb b/app/models/domain.rb index f21317b70..011d02ec7 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -90,6 +90,7 @@ class Domain < ApplicationRecord validates :transfer_code, presence: true validate :validate_reservation + def validate_reservation return if persisted? || !in_reserved_list? @@ -99,6 +100,7 @@ class Domain < ApplicationRecord end return if ReservedDomain.pw_for(name) == reserved_pw + errors.add(:base, :invalid_auth_information_reserved) end @@ -170,7 +172,7 @@ class Domain < ApplicationRecord end attr_accessor :registrant_typeahead, :update_me, - :epp_pending_update, :epp_pending_delete, :reserved_pw + :epp_pending_update, :epp_pending_delete, :reserved_pw, :disputed_pw self.ignored_columns = %w[legacy_id legacy_registrar_id legacy_registrant_id] @@ -275,6 +277,10 @@ class Domain < ApplicationRecord @in_reserved_list ||= ReservedDomain.by_domain(name).any? end + def disputed? + Dispute.active.where(domain_name: name).any? + end + def pending_transfer transfers.find_by(status: DomainTransfer::PENDING) end diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index dc80b2e40..31fee711d 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -58,7 +58,8 @@ class Epp::Domain < Domain '2003' => [ # Required parameter missing [:registrant, :blank], [:registrar, :blank], - [:base, :required_parameter_missing_reserved] + [:base, :required_parameter_missing_reserved], + [:base, :required_parameter_missing_disputed] ], '2004' => [ # Parameter value range error [:dnskeys, :out_of_range, @@ -88,7 +89,8 @@ class Epp::Domain < Domain [:transfer_code, :wrong_pw] ], '2202' => [ - [:base, :invalid_auth_information_reserved] + [:base, :invalid_auth_information_reserved], + [:base, :invalid_auth_information_disputed] ], '2302' => [ # Object exists [:name_dirty, :taken, { value: { obj: 'name', val: name_dirty } }], @@ -154,6 +156,7 @@ class Epp::Domain < Domain at[:period_unit] = Epp::Domain.parse_period_unit_from_frame(frame) || 'y' at[:reserved_pw] = frame.css('reserved > pw').text + at[:disputed_pw] = frame.css('disputed > pw').text # at[:statuses] = domain_statuses_attrs(frame, action) at[:nameservers_attributes] = nameservers_attrs(frame, action) @@ -475,6 +478,16 @@ class Epp::Domain < Domain same_registrant_as_current = (registrant.code == frame.css('registrant').text) + if !same_registrant_as_current && disputed? + disputed_pw = frame.css('disputed > pw').text + if disputed_pw.blank? + add_epp_error('2304', nil, nil, 'Required parameter missing; disputed pw element required for dispute domains') + else + dispute = Dispute.active.find_by(domain_name: name, password: disputed_pw) + add_epp_error('2202', nil, nil, 'Invalid authorization information; invalid disputed>pw value') if dispute.nil? + end + end + if !same_registrant_as_current && errors.empty? && verify && Setting.request_confrimation_on_registrant_change_enabled && frame.css('registrant').present? && @@ -706,6 +719,11 @@ class Epp::Domain < Domain def can_be_deleted? + if disputed? + errors.add(:base, :domain_status_prohibits_operation) + return false + end + begin errors.add(:base, :domain_status_prohibits_operation) return false diff --git a/app/models/setting.rb b/app/models/setting.rb index 64a20c34f..9f00055a3 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -46,6 +46,7 @@ class Setting < RailsSettings::Base expire_warning_period redemption_grace_period expire_pending_confirmation + dispute_period_in_months ] end diff --git a/config/app.yml b/config/app.yml index 763da3373..f11189111 100644 --- a/config/app.yml +++ b/config/app.yml @@ -44,6 +44,8 @@ defaults: &defaults registrar_ip_whitelist_enabled: false api_ip_whitelist_enabled: false + dispute_period_in_months: 36 + registry_juridical_name: "Eesti Interneti SA" registry_reg_no: "90010019" registry_email: "info@internet.ee" diff --git a/config/locales/admin/disputes.en.yml b/config/locales/admin/disputes.en.yml index 4073d6e61..ba5b79099 100644 --- a/config/locales/admin/disputes.en.yml +++ b/config/locales/admin/disputes.en.yml @@ -8,3 +8,5 @@ en: form: password_hint: Generated automatically if left blank + optional: Not required by default + in_future: Must be at least today / in future diff --git a/config/locales/en.yml b/config/locales/en.yml index f1d2ad817..a825b1dc0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,6 +24,8 @@ en: key_data_not_allowed: 'keyData object is not allowed' required_parameter_missing_reserved: 'Required parameter missing; reserved>pw element required for reserved domains' invalid_auth_information_reserved: 'Invalid authorization information; invalid reserved>pw value' + required_parameter_missing_disputed: 'Required parameter missing; disputed pw element required for dispute domains' + invalid_auth_information_disputed: 'Invalid authorization information; invalid disputed>pw value' domain_name_blocked: 'Data management policy violation: Domain name is blocked [name]' name_dirty: invalid: 'Domain name is invalid' @@ -631,6 +633,7 @@ en: add_blocked_domain: 'Add domain to blocked list' add_disputed_domain: 'Add domain to disputed list' edit_pw: 'Edit Pw' + edit_dispute: 'Edit dispute' optional: 'Optional' test_registrar: "Test registrar" verified_confirm: 'Verified status is for cases when current registrant is the one applying for the update. Legal document signed by the registrant is required. Are you sure this update is properly verified with the registrant?' diff --git a/config/routes.rb b/config/routes.rb index 0d2093d36..4ce06b651 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,6 @@ require_dependency 'epp_constraint' Rails.application.routes.draw do - resources :disputes # https://github.com/internetee/epp_proxy#translation-of-epp-calls namespace :epp do constraints(EppConstraint.new(:session)) do @@ -259,7 +258,11 @@ Rails.application.routes.draw do get 'delete' end end - resources :disputes + resources :disputes do + member do + get 'delete' + end + end resources :registrars do resources :api_users, except: %i[index] diff --git a/db/migrate/20200421093637_create_disputes.rb b/db/migrate/20200421093637_create_disputes.rb index 48cdfae59..b934d3297 100644 --- a/db/migrate/20200421093637_create_disputes.rb +++ b/db/migrate/20200421093637_create_disputes.rb @@ -1,12 +1,12 @@ class CreateDisputes < ActiveRecord::Migration[5.2] def change create_table :disputes do |t| - t.string :domain_name - t.string :password - t.date :expires_at - t.date :starts_at + t.string :domain_name, null: false + t.string :password, null: false + t.date :expires_at, null: false + t.date :starts_at, null: false t.text :comment - t.datetime :created_at + t.boolean :closed, null: false, default: false t.timestamps end diff --git a/db/structure.sql b/db/structure.sql index 604238d4c..2e8294d41 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1,28 +1,19 @@ --- --- PostgreSQL database dump --- - SET statement_timeout = 0; SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; +SET row_security = off; -- --- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - +-- Name: audit; Type: SCHEMA; Schema: -; Owner: - -- -CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; - - --- --- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; +CREATE SCHEMA audit; -- @@ -191,12 +182,75 @@ CREATE FUNCTION public.generate_zonefile(i_origin character varying) RETURNS tex $_$; +-- +-- Name: process_contact_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_contact_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.contacts + (object_id, action, recorded_at, old_value, new_value) + VALUES (NEW.id, 'INSERT', now(), '{}', to_json(NEW)::jsonb); + RETURN NEW; + ELSEIF (TG_OP = 'UPDATE') THEN + INSERT INTO audit.contacts + (object_id, action, recorded_at, old_value, new_value) + VALUES (NEW.id, 'UPDATE', now(), to_json(OLD)::jsonb, to_json(NEW)::jsonb); + RETURN NEW; + ELSEIF (TG_OP = 'DELETE') THEN + INSERT INTO audit.contacts + (object_id, action, recorded_at, old_value, new_value) + VALUES (OLD.id, 'DELETE', now(), to_json(OLD)::jsonb, '{}'); + RETURN OLD; + END IF; + RETURN NULL; + END +$$; + + SET default_tablespace = ''; SET default_with_oids = false; -- --- Name: account_activities; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: contacts; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.contacts ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT contacts_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: contacts_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.contacts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.contacts_id_seq OWNED BY audit.contacts.id; + + +-- +-- Name: account_activities; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.account_activities ( @@ -236,7 +290,7 @@ ALTER SEQUENCE public.account_activities_id_seq OWNED BY public.account_activiti -- --- Name: accounts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: accounts; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.accounts ( @@ -272,7 +326,7 @@ ALTER SEQUENCE public.accounts_id_seq OWNED BY public.accounts.id; -- --- Name: actions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: actions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.actions ( @@ -304,7 +358,7 @@ ALTER SEQUENCE public.actions_id_seq OWNED BY public.actions.id; -- --- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.ar_internal_metadata ( @@ -316,7 +370,7 @@ CREATE TABLE public.ar_internal_metadata ( -- --- Name: auctions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: auctions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.auctions ( @@ -349,7 +403,7 @@ ALTER SEQUENCE public.auctions_id_seq OWNED BY public.auctions.id; -- --- Name: bank_statements; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: bank_statements; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.bank_statements ( @@ -385,7 +439,7 @@ ALTER SEQUENCE public.bank_statements_id_seq OWNED BY public.bank_statements.id; -- --- Name: bank_transactions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: bank_transactions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.bank_transactions ( @@ -429,7 +483,7 @@ ALTER SEQUENCE public.bank_transactions_id_seq OWNED BY public.bank_transactions -- --- Name: blocked_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: blocked_domains; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.blocked_domains ( @@ -462,7 +516,7 @@ ALTER SEQUENCE public.blocked_domains_id_seq OWNED BY public.blocked_domains.id; -- --- Name: certificates; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: certificates; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.certificates ( @@ -500,7 +554,7 @@ ALTER SEQUENCE public.certificates_id_seq OWNED BY public.certificates.id; -- --- Name: contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: contacts; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.contacts ( @@ -558,7 +612,7 @@ ALTER SEQUENCE public.contacts_id_seq OWNED BY public.contacts.id; -- --- Name: directos; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: directos; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.directos ( @@ -593,7 +647,43 @@ ALTER SEQUENCE public.directos_id_seq OWNED BY public.directos.id; -- --- Name: dnskeys; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: disputes; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.disputes ( + id bigint NOT NULL, + domain_name character varying NOT NULL, + password character varying NOT NULL, + expires_at date NOT NULL, + starts_at date NOT NULL, + comment text, + closed boolean DEFAULT false NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: disputes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.disputes_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: disputes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.disputes_id_seq OWNED BY public.disputes.id; + + +-- +-- Name: dnskeys; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.dnskeys ( @@ -634,7 +724,7 @@ ALTER SEQUENCE public.dnskeys_id_seq OWNED BY public.dnskeys.id; -- --- Name: domain_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: domain_contacts; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.domain_contacts ( @@ -672,7 +762,7 @@ ALTER SEQUENCE public.domain_contacts_id_seq OWNED BY public.domain_contacts.id; -- --- Name: domain_transfers; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: domain_transfers; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.domain_transfers ( @@ -709,7 +799,7 @@ ALTER SEQUENCE public.domain_transfers_id_seq OWNED BY public.domain_transfers.i -- --- Name: domains; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: domains; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.domains ( @@ -769,7 +859,7 @@ ALTER SEQUENCE public.domains_id_seq OWNED BY public.domains.id; -- --- Name: epp_sessions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: epp_sessions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.epp_sessions ( @@ -801,7 +891,7 @@ ALTER SEQUENCE public.epp_sessions_id_seq OWNED BY public.epp_sessions.id; -- --- Name: invoice_items; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: invoice_items; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.invoice_items ( @@ -839,7 +929,7 @@ ALTER SEQUENCE public.invoice_items_id_seq OWNED BY public.invoice_items.id; -- --- Name: invoices; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: invoices; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.invoices ( @@ -910,7 +1000,7 @@ ALTER SEQUENCE public.invoices_id_seq OWNED BY public.invoices.id; -- --- Name: legal_documents; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: legal_documents; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.legal_documents ( @@ -945,7 +1035,7 @@ ALTER SEQUENCE public.legal_documents_id_seq OWNED BY public.legal_documents.id; -- --- Name: log_account_activities; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_account_activities; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_account_activities ( @@ -983,7 +1073,7 @@ ALTER SEQUENCE public.log_account_activities_id_seq OWNED BY public.log_account_ -- --- Name: log_accounts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_accounts; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_accounts ( @@ -1021,7 +1111,7 @@ ALTER SEQUENCE public.log_accounts_id_seq OWNED BY public.log_accounts.id; -- --- Name: log_actions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_actions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_actions ( @@ -1059,7 +1149,7 @@ ALTER SEQUENCE public.log_actions_id_seq OWNED BY public.log_actions.id; -- --- Name: log_bank_statements; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_bank_statements; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_bank_statements ( @@ -1097,7 +1187,7 @@ ALTER SEQUENCE public.log_bank_statements_id_seq OWNED BY public.log_bank_statem -- --- Name: log_bank_transactions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_bank_transactions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_bank_transactions ( @@ -1135,7 +1225,7 @@ ALTER SEQUENCE public.log_bank_transactions_id_seq OWNED BY public.log_bank_tran -- --- Name: log_blocked_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_blocked_domains; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_blocked_domains ( @@ -1173,7 +1263,7 @@ ALTER SEQUENCE public.log_blocked_domains_id_seq OWNED BY public.log_blocked_dom -- --- Name: log_certificates; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_certificates; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_certificates ( @@ -1211,7 +1301,7 @@ ALTER SEQUENCE public.log_certificates_id_seq OWNED BY public.log_certificates.i -- --- Name: log_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_contacts; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_contacts ( @@ -1250,7 +1340,7 @@ ALTER SEQUENCE public.log_contacts_id_seq OWNED BY public.log_contacts.id; -- --- Name: log_dnskeys; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_dnskeys; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_dnskeys ( @@ -1288,7 +1378,7 @@ ALTER SEQUENCE public.log_dnskeys_id_seq OWNED BY public.log_dnskeys.id; -- --- Name: log_domain_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_domain_contacts; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_domain_contacts ( @@ -1326,7 +1416,7 @@ ALTER SEQUENCE public.log_domain_contacts_id_seq OWNED BY public.log_domain_cont -- --- Name: log_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_domains; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_domains ( @@ -1364,7 +1454,7 @@ ALTER SEQUENCE public.log_domains_id_seq OWNED BY public.log_domains.id; -- --- Name: log_invoice_items; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_invoice_items; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_invoice_items ( @@ -1402,7 +1492,7 @@ ALTER SEQUENCE public.log_invoice_items_id_seq OWNED BY public.log_invoice_items -- --- Name: log_invoices; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_invoices; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_invoices ( @@ -1440,7 +1530,7 @@ ALTER SEQUENCE public.log_invoices_id_seq OWNED BY public.log_invoices.id; -- --- Name: log_nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_nameservers; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_nameservers ( @@ -1478,7 +1568,7 @@ ALTER SEQUENCE public.log_nameservers_id_seq OWNED BY public.log_nameservers.id; -- --- Name: log_notifications; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_notifications; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_notifications ( @@ -1516,7 +1606,7 @@ ALTER SEQUENCE public.log_notifications_id_seq OWNED BY public.log_notifications -- --- Name: log_payment_orders; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_payment_orders; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_payment_orders ( @@ -1554,7 +1644,7 @@ ALTER SEQUENCE public.log_payment_orders_id_seq OWNED BY public.log_payment_orde -- --- Name: log_registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_registrant_verifications; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_registrant_verifications ( @@ -1591,7 +1681,7 @@ ALTER SEQUENCE public.log_registrant_verifications_id_seq OWNED BY public.log_re -- --- Name: log_registrars; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_registrars; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_registrars ( @@ -1629,7 +1719,7 @@ ALTER SEQUENCE public.log_registrars_id_seq OWNED BY public.log_registrars.id; -- --- Name: log_reserved_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_reserved_domains; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_reserved_domains ( @@ -1667,7 +1757,7 @@ ALTER SEQUENCE public.log_reserved_domains_id_seq OWNED BY public.log_reserved_d -- --- Name: log_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_settings; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_settings ( @@ -1705,7 +1795,7 @@ ALTER SEQUENCE public.log_settings_id_seq OWNED BY public.log_settings.id; -- --- Name: log_users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_users; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_users ( @@ -1743,7 +1833,7 @@ ALTER SEQUENCE public.log_users_id_seq OWNED BY public.log_users.id; -- --- Name: log_white_ips; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_white_ips; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_white_ips ( @@ -1781,7 +1871,7 @@ ALTER SEQUENCE public.log_white_ips_id_seq OWNED BY public.log_white_ips.id; -- --- Name: nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: nameservers; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.nameservers ( @@ -1819,7 +1909,7 @@ ALTER SEQUENCE public.nameservers_id_seq OWNED BY public.nameservers.id; -- --- Name: notifications; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: notifications; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.notifications ( @@ -1857,7 +1947,7 @@ ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id; -- --- Name: payment_orders; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: payment_orders; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.payment_orders ( @@ -1894,7 +1984,7 @@ ALTER SEQUENCE public.payment_orders_id_seq OWNED BY public.payment_orders.id; -- --- Name: prices; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: prices; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.prices ( @@ -1932,7 +2022,7 @@ ALTER SEQUENCE public.prices_id_seq OWNED BY public.prices.id; -- --- Name: que_jobs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: que_jobs; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.que_jobs ( @@ -1974,7 +2064,7 @@ ALTER SEQUENCE public.que_jobs_job_id_seq OWNED BY public.que_jobs.job_id; -- --- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.registrant_verifications ( @@ -2010,7 +2100,7 @@ ALTER SEQUENCE public.registrant_verifications_id_seq OWNED BY public.registrant -- --- Name: registrars; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: registrars; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.registrars ( @@ -2063,7 +2153,7 @@ ALTER SEQUENCE public.registrars_id_seq OWNED BY public.registrars.id; -- --- Name: reserved_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: reserved_domains; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.reserved_domains ( @@ -2098,7 +2188,7 @@ ALTER SEQUENCE public.reserved_domains_id_seq OWNED BY public.reserved_domains.i -- --- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.schema_migrations ( @@ -2107,7 +2197,7 @@ CREATE TABLE public.schema_migrations ( -- --- Name: settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: settings; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.settings ( @@ -2143,7 +2233,7 @@ ALTER SEQUENCE public.settings_id_seq OWNED BY public.settings.id; -- --- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: users; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.users ( @@ -2195,7 +2285,7 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; -- --- Name: versions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: versions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.versions ( @@ -2230,7 +2320,7 @@ ALTER SEQUENCE public.versions_id_seq OWNED BY public.versions.id; -- --- Name: white_ips; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: white_ips; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.white_ips ( @@ -2266,7 +2356,7 @@ ALTER SEQUENCE public.white_ips_id_seq OWNED BY public.white_ips.id; -- --- Name: whois_records; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: whois_records; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.whois_records ( @@ -2301,7 +2391,7 @@ ALTER SEQUENCE public.whois_records_id_seq OWNED BY public.whois_records.id; -- --- Name: zones; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: zones; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.zones ( @@ -2344,385 +2434,407 @@ ALTER SEQUENCE public.zones_id_seq OWNED BY public.zones.id; -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: contacts id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.contacts ALTER COLUMN id SET DEFAULT nextval('audit.contacts_id_seq'::regclass); + + +-- +-- Name: account_activities id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities ALTER COLUMN id SET DEFAULT nextval('public.account_activities_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: accounts id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.accounts ALTER COLUMN id SET DEFAULT nextval('public.accounts_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: actions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.actions ALTER COLUMN id SET DEFAULT nextval('public.actions_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: auctions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.auctions ALTER COLUMN id SET DEFAULT nextval('public.auctions_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: bank_statements id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.bank_statements ALTER COLUMN id SET DEFAULT nextval('public.bank_statements_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: bank_transactions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.bank_transactions ALTER COLUMN id SET DEFAULT nextval('public.bank_transactions_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: blocked_domains id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.blocked_domains ALTER COLUMN id SET DEFAULT nextval('public.blocked_domains_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: certificates id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.certificates ALTER COLUMN id SET DEFAULT nextval('public.certificates_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: contacts id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts ALTER COLUMN id SET DEFAULT nextval('public.contacts_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: directos id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.directos ALTER COLUMN id SET DEFAULT nextval('public.directos_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: disputes id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.disputes ALTER COLUMN id SET DEFAULT nextval('public.disputes_id_seq'::regclass); + + +-- +-- Name: dnskeys id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.dnskeys ALTER COLUMN id SET DEFAULT nextval('public.dnskeys_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: domain_contacts id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_contacts ALTER COLUMN id SET DEFAULT nextval('public.domain_contacts_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: domain_transfers id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers ALTER COLUMN id SET DEFAULT nextval('public.domain_transfers_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: domains id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domains ALTER COLUMN id SET DEFAULT nextval('public.domains_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: epp_sessions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.epp_sessions ALTER COLUMN id SET DEFAULT nextval('public.epp_sessions_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: invoice_items id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoice_items ALTER COLUMN id SET DEFAULT nextval('public.invoice_items_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: invoices id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoices ALTER COLUMN id SET DEFAULT nextval('public.invoices_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: legal_documents id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.legal_documents ALTER COLUMN id SET DEFAULT nextval('public.legal_documents_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_account_activities id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_account_activities ALTER COLUMN id SET DEFAULT nextval('public.log_account_activities_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_accounts id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_accounts ALTER COLUMN id SET DEFAULT nextval('public.log_accounts_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_actions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_actions ALTER COLUMN id SET DEFAULT nextval('public.log_actions_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_bank_statements id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_bank_statements ALTER COLUMN id SET DEFAULT nextval('public.log_bank_statements_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_bank_transactions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_bank_transactions ALTER COLUMN id SET DEFAULT nextval('public.log_bank_transactions_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_blocked_domains id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_blocked_domains ALTER COLUMN id SET DEFAULT nextval('public.log_blocked_domains_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_certificates id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_certificates ALTER COLUMN id SET DEFAULT nextval('public.log_certificates_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_contacts id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_contacts ALTER COLUMN id SET DEFAULT nextval('public.log_contacts_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_dnskeys id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_dnskeys ALTER COLUMN id SET DEFAULT nextval('public.log_dnskeys_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_domain_contacts id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_domain_contacts ALTER COLUMN id SET DEFAULT nextval('public.log_domain_contacts_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_domains id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_domains ALTER COLUMN id SET DEFAULT nextval('public.log_domains_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_invoice_items id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_invoice_items ALTER COLUMN id SET DEFAULT nextval('public.log_invoice_items_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_invoices id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_invoices ALTER COLUMN id SET DEFAULT nextval('public.log_invoices_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_nameservers id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_nameservers ALTER COLUMN id SET DEFAULT nextval('public.log_nameservers_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_notifications id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_notifications ALTER COLUMN id SET DEFAULT nextval('public.log_notifications_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_payment_orders id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_payment_orders ALTER COLUMN id SET DEFAULT nextval('public.log_payment_orders_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_registrant_verifications id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_registrant_verifications ALTER COLUMN id SET DEFAULT nextval('public.log_registrant_verifications_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_registrars id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_registrars ALTER COLUMN id SET DEFAULT nextval('public.log_registrars_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_reserved_domains id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_reserved_domains ALTER COLUMN id SET DEFAULT nextval('public.log_reserved_domains_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_settings id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_settings ALTER COLUMN id SET DEFAULT nextval('public.log_settings_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_users id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_users ALTER COLUMN id SET DEFAULT nextval('public.log_users_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: log_white_ips id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_white_ips ALTER COLUMN id SET DEFAULT nextval('public.log_white_ips_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: nameservers id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.nameservers ALTER COLUMN id SET DEFAULT nextval('public.nameservers_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: notifications id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: payment_orders id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.payment_orders ALTER COLUMN id SET DEFAULT nextval('public.payment_orders_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: prices id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.prices ALTER COLUMN id SET DEFAULT nextval('public.prices_id_seq'::regclass); -- --- Name: job_id; Type: DEFAULT; Schema: public; Owner: - +-- Name: que_jobs job_id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.que_jobs ALTER COLUMN job_id SET DEFAULT nextval('public.que_jobs_job_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: registrant_verifications id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrant_verifications ALTER COLUMN id SET DEFAULT nextval('public.registrant_verifications_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: registrars id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrars ALTER COLUMN id SET DEFAULT nextval('public.registrars_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: reserved_domains id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.reserved_domains ALTER COLUMN id SET DEFAULT nextval('public.reserved_domains_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: settings id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.settings ALTER COLUMN id SET DEFAULT nextval('public.settings_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: users id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: versions id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.versions ALTER COLUMN id SET DEFAULT nextval('public.versions_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: white_ips id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.white_ips ALTER COLUMN id SET DEFAULT nextval('public.white_ips_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: whois_records id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.whois_records ALTER COLUMN id SET DEFAULT nextval('public.whois_records_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: zones id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.zones ALTER COLUMN id SET DEFAULT nextval('public.zones_id_seq'::regclass); -- --- Name: account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.contacts + ADD CONSTRAINT contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: account_activities account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -2730,7 +2842,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: accounts accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.accounts @@ -2738,7 +2850,7 @@ ALTER TABLE ONLY public.accounts -- --- Name: actions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: actions actions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.actions @@ -2746,7 +2858,7 @@ ALTER TABLE ONLY public.actions -- --- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.ar_internal_metadata @@ -2754,7 +2866,7 @@ ALTER TABLE ONLY public.ar_internal_metadata -- --- Name: auctions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: auctions auctions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.auctions @@ -2762,7 +2874,7 @@ ALTER TABLE ONLY public.auctions -- --- Name: bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: bank_statements bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.bank_statements @@ -2770,7 +2882,7 @@ ALTER TABLE ONLY public.bank_statements -- --- Name: bank_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: bank_transactions bank_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.bank_transactions @@ -2778,7 +2890,7 @@ ALTER TABLE ONLY public.bank_transactions -- --- Name: blocked_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: blocked_domains blocked_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.blocked_domains @@ -2786,7 +2898,7 @@ ALTER TABLE ONLY public.blocked_domains -- --- Name: certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: certificates certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.certificates @@ -2794,7 +2906,7 @@ ALTER TABLE ONLY public.certificates -- --- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts @@ -2802,7 +2914,7 @@ ALTER TABLE ONLY public.contacts -- --- Name: directos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: directos directos_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.directos @@ -2810,7 +2922,15 @@ ALTER TABLE ONLY public.directos -- --- Name: dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: disputes disputes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.disputes + ADD CONSTRAINT disputes_pkey PRIMARY KEY (id); + + +-- +-- Name: dnskeys dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.dnskeys @@ -2818,7 +2938,7 @@ ALTER TABLE ONLY public.dnskeys -- --- Name: domain_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: domain_contacts domain_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_contacts @@ -2826,7 +2946,7 @@ ALTER TABLE ONLY public.domain_contacts -- --- Name: domain_transfers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: domain_transfers domain_transfers_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers @@ -2834,7 +2954,7 @@ ALTER TABLE ONLY public.domain_transfers -- --- Name: domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: domains domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domains @@ -2842,7 +2962,7 @@ ALTER TABLE ONLY public.domains -- --- Name: epp_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: epp_sessions epp_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.epp_sessions @@ -2850,7 +2970,7 @@ ALTER TABLE ONLY public.epp_sessions -- --- Name: invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: invoice_items invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoice_items @@ -2858,7 +2978,7 @@ ALTER TABLE ONLY public.invoice_items -- --- Name: invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: invoices invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoices @@ -2866,7 +2986,7 @@ ALTER TABLE ONLY public.invoices -- --- Name: legal_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: legal_documents legal_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.legal_documents @@ -2874,7 +2994,7 @@ ALTER TABLE ONLY public.legal_documents -- --- Name: log_account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_account_activities log_account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_account_activities @@ -2882,7 +3002,7 @@ ALTER TABLE ONLY public.log_account_activities -- --- Name: log_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_accounts log_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_accounts @@ -2890,7 +3010,7 @@ ALTER TABLE ONLY public.log_accounts -- --- Name: log_actions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_actions log_actions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_actions @@ -2898,7 +3018,7 @@ ALTER TABLE ONLY public.log_actions -- --- Name: log_bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_bank_statements log_bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_bank_statements @@ -2906,7 +3026,7 @@ ALTER TABLE ONLY public.log_bank_statements -- --- Name: log_bank_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_bank_transactions log_bank_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_bank_transactions @@ -2914,7 +3034,7 @@ ALTER TABLE ONLY public.log_bank_transactions -- --- Name: log_blocked_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_blocked_domains log_blocked_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_blocked_domains @@ -2922,7 +3042,7 @@ ALTER TABLE ONLY public.log_blocked_domains -- --- Name: log_certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_certificates log_certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_certificates @@ -2930,7 +3050,7 @@ ALTER TABLE ONLY public.log_certificates -- --- Name: log_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_contacts log_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_contacts @@ -2938,7 +3058,7 @@ ALTER TABLE ONLY public.log_contacts -- --- Name: log_dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_dnskeys log_dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_dnskeys @@ -2946,7 +3066,7 @@ ALTER TABLE ONLY public.log_dnskeys -- --- Name: log_domain_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_domain_contacts log_domain_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_domain_contacts @@ -2954,7 +3074,7 @@ ALTER TABLE ONLY public.log_domain_contacts -- --- Name: log_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_domains log_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_domains @@ -2962,7 +3082,7 @@ ALTER TABLE ONLY public.log_domains -- --- Name: log_invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_invoice_items log_invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_invoice_items @@ -2970,7 +3090,7 @@ ALTER TABLE ONLY public.log_invoice_items -- --- Name: log_invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_invoices log_invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_invoices @@ -2978,7 +3098,7 @@ ALTER TABLE ONLY public.log_invoices -- --- Name: log_nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_nameservers log_nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_nameservers @@ -2986,7 +3106,7 @@ ALTER TABLE ONLY public.log_nameservers -- --- Name: log_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_notifications log_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_notifications @@ -2994,7 +3114,7 @@ ALTER TABLE ONLY public.log_notifications -- --- Name: log_payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_payment_orders log_payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_payment_orders @@ -3002,7 +3122,7 @@ ALTER TABLE ONLY public.log_payment_orders -- --- Name: log_registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_registrant_verifications log_registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_registrant_verifications @@ -3010,7 +3130,7 @@ ALTER TABLE ONLY public.log_registrant_verifications -- --- Name: log_registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_registrars log_registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_registrars @@ -3018,7 +3138,7 @@ ALTER TABLE ONLY public.log_registrars -- --- Name: log_reserved_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_reserved_domains log_reserved_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_reserved_domains @@ -3026,7 +3146,7 @@ ALTER TABLE ONLY public.log_reserved_domains -- --- Name: log_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_settings log_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_settings @@ -3034,7 +3154,7 @@ ALTER TABLE ONLY public.log_settings -- --- Name: log_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_users log_users_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_users @@ -3042,7 +3162,7 @@ ALTER TABLE ONLY public.log_users -- --- Name: log_white_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_white_ips log_white_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_white_ips @@ -3050,7 +3170,7 @@ ALTER TABLE ONLY public.log_white_ips -- --- Name: nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: nameservers nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.nameservers @@ -3058,7 +3178,7 @@ ALTER TABLE ONLY public.nameservers -- --- Name: notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.notifications @@ -3066,7 +3186,7 @@ ALTER TABLE ONLY public.notifications -- --- Name: payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: payment_orders payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.payment_orders @@ -3074,7 +3194,7 @@ ALTER TABLE ONLY public.payment_orders -- --- Name: prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: prices prices_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.prices @@ -3082,7 +3202,7 @@ ALTER TABLE ONLY public.prices -- --- Name: que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: que_jobs que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.que_jobs @@ -3090,7 +3210,7 @@ ALTER TABLE ONLY public.que_jobs -- --- Name: registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: registrant_verifications registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrant_verifications @@ -3098,7 +3218,7 @@ ALTER TABLE ONLY public.registrant_verifications -- --- Name: registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: registrars registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrars @@ -3106,7 +3226,7 @@ ALTER TABLE ONLY public.registrars -- --- Name: reserved_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: reserved_domains reserved_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.reserved_domains @@ -3114,7 +3234,7 @@ ALTER TABLE ONLY public.reserved_domains -- --- Name: settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: settings settings_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.settings @@ -3122,7 +3242,7 @@ ALTER TABLE ONLY public.settings -- --- Name: uniq_blocked_domains_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: blocked_domains uniq_blocked_domains_name; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.blocked_domains @@ -3130,7 +3250,7 @@ ALTER TABLE ONLY public.blocked_domains -- --- Name: uniq_contact_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: contacts uniq_contact_uuid; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts @@ -3138,7 +3258,7 @@ ALTER TABLE ONLY public.contacts -- --- Name: uniq_domain_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: domains uniq_domain_uuid; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domains @@ -3146,7 +3266,7 @@ ALTER TABLE ONLY public.domains -- --- Name: uniq_reserved_domains_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: reserved_domains uniq_reserved_domains_name; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.reserved_domains @@ -3154,7 +3274,7 @@ ALTER TABLE ONLY public.reserved_domains -- --- Name: uniq_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: auctions uniq_uuid; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.auctions @@ -3162,7 +3282,7 @@ ALTER TABLE ONLY public.auctions -- --- Name: unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: registrars unique_code; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrars @@ -3170,7 +3290,7 @@ ALTER TABLE ONLY public.registrars -- --- Name: unique_contact_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: contacts unique_contact_code; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts @@ -3178,7 +3298,7 @@ ALTER TABLE ONLY public.contacts -- --- Name: unique_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: registrars unique_name; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrars @@ -3186,7 +3306,7 @@ ALTER TABLE ONLY public.registrars -- --- Name: unique_number; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: invoices unique_number; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoices @@ -3194,7 +3314,7 @@ ALTER TABLE ONLY public.invoices -- --- Name: unique_reference_no; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: registrars unique_reference_no; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrars @@ -3202,7 +3322,7 @@ ALTER TABLE ONLY public.registrars -- --- Name: unique_registration_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: auctions unique_registration_code; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.auctions @@ -3210,7 +3330,7 @@ ALTER TABLE ONLY public.auctions -- --- Name: unique_session_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: epp_sessions unique_session_id; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.epp_sessions @@ -3218,7 +3338,7 @@ ALTER TABLE ONLY public.epp_sessions -- --- Name: unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: zones unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.zones @@ -3226,7 +3346,7 @@ ALTER TABLE ONLY public.zones -- --- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users @@ -3234,7 +3354,7 @@ ALTER TABLE ONLY public.users -- --- Name: versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: versions versions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.versions @@ -3242,7 +3362,7 @@ ALTER TABLE ONLY public.versions -- --- Name: white_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: white_ips white_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.white_ips @@ -3250,7 +3370,7 @@ ALTER TABLE ONLY public.white_ips -- --- Name: whois_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: whois_records whois_records_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.whois_records @@ -3258,7 +3378,7 @@ ALTER TABLE ONLY public.whois_records -- --- Name: zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: zones zones_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.zones @@ -3266,581 +3386,602 @@ ALTER TABLE ONLY public.zones -- --- Name: index_account_activities_on_account_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: contacts_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX contacts_object_id_idx ON audit.contacts USING btree (object_id); + + +-- +-- Name: contacts_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX contacts_recorded_at_idx ON audit.contacts USING btree (recorded_at); + + +-- +-- Name: index_account_activities_on_account_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_account_activities_on_account_id ON public.account_activities USING btree (account_id); -- --- Name: index_account_activities_on_bank_transaction_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_account_activities_on_bank_transaction_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_account_activities_on_bank_transaction_id ON public.account_activities USING btree (bank_transaction_id); -- --- Name: index_account_activities_on_invoice_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_account_activities_on_invoice_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_account_activities_on_invoice_id ON public.account_activities USING btree (invoice_id); -- --- Name: index_accounts_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_accounts_on_registrar_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_accounts_on_registrar_id ON public.accounts USING btree (registrar_id); -- --- Name: index_certificates_on_api_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_certificates_on_api_user_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_certificates_on_api_user_id ON public.certificates USING btree (api_user_id); -- --- Name: index_contacts_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_contacts_on_code; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_contacts_on_code ON public.contacts USING btree (code); -- --- Name: index_contacts_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_contacts_on_registrar_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_contacts_on_registrar_id ON public.contacts USING btree (registrar_id); -- --- Name: index_contacts_on_registrar_id_and_ident_type; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_contacts_on_registrar_id_and_ident_type; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_contacts_on_registrar_id_and_ident_type ON public.contacts USING btree (registrar_id, ident_type); -- --- Name: index_directos_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_directos_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_directos_on_item_type_and_item_id ON public.directos USING btree (item_type, item_id); -- --- Name: index_dnskeys_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_dnskeys_on_domain_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_dnskeys_on_domain_id ON public.dnskeys USING btree (domain_id); -- --- Name: index_dnskeys_on_legacy_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_dnskeys_on_legacy_domain_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_dnskeys_on_legacy_domain_id ON public.dnskeys USING btree (legacy_domain_id); -- --- Name: index_domain_contacts_on_contact_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domain_contacts_on_contact_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domain_contacts_on_contact_id ON public.domain_contacts USING btree (contact_id); -- --- Name: index_domain_contacts_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domain_contacts_on_domain_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domain_contacts_on_domain_id ON public.domain_contacts USING btree (domain_id); -- --- Name: index_domain_transfers_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domain_transfers_on_domain_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domain_transfers_on_domain_id ON public.domain_transfers USING btree (domain_id); -- --- Name: index_domains_on_delete_date; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domains_on_delete_date; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domains_on_delete_date ON public.domains USING btree (delete_date); -- --- Name: index_domains_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domains_on_name; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_domains_on_name ON public.domains USING btree (name); -- --- Name: index_domains_on_outzone_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domains_on_outzone_at; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domains_on_outzone_at ON public.domains USING btree (outzone_at); -- --- Name: index_domains_on_registrant_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domains_on_registrant_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domains_on_registrant_id ON public.domains USING btree (registrant_id); -- --- Name: index_domains_on_registrant_verification_asked_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domains_on_registrant_verification_asked_at; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domains_on_registrant_verification_asked_at ON public.domains USING btree (registrant_verification_asked_at); -- --- Name: index_domains_on_registrant_verification_token; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domains_on_registrant_verification_token; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domains_on_registrant_verification_token ON public.domains USING btree (registrant_verification_token); -- --- Name: index_domains_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domains_on_registrar_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domains_on_registrar_id ON public.domains USING btree (registrar_id); -- --- Name: index_domains_on_statuses; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_domains_on_statuses; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_domains_on_statuses ON public.domains USING gin (statuses); -- --- Name: index_epp_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_epp_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_epp_sessions_on_updated_at ON public.epp_sessions USING btree (updated_at); -- --- Name: index_invoice_items_on_invoice_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_invoice_items_on_invoice_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_invoice_items_on_invoice_id ON public.invoice_items USING btree (invoice_id); -- --- Name: index_invoices_on_buyer_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_invoices_on_buyer_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_invoices_on_buyer_id ON public.invoices USING btree (buyer_id); -- --- Name: index_legal_documents_on_checksum; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_legal_documents_on_checksum; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_legal_documents_on_checksum ON public.legal_documents USING btree (checksum); -- --- Name: index_legal_documents_on_documentable_type_and_documentable_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_legal_documents_on_documentable_type_and_documentable_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_legal_documents_on_documentable_type_and_documentable_id ON public.legal_documents USING btree (documentable_type, documentable_id); -- --- Name: index_log_account_activities_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_account_activities_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_account_activities_on_item_type_and_item_id ON public.log_account_activities USING btree (item_type, item_id); -- --- Name: index_log_account_activities_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_account_activities_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_account_activities_on_whodunnit ON public.log_account_activities USING btree (whodunnit); -- --- Name: index_log_accounts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_accounts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_accounts_on_item_type_and_item_id ON public.log_accounts USING btree (item_type, item_id); -- --- Name: index_log_accounts_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_accounts_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_accounts_on_whodunnit ON public.log_accounts USING btree (whodunnit); -- --- Name: index_log_bank_statements_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_bank_statements_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_bank_statements_on_item_type_and_item_id ON public.log_bank_statements USING btree (item_type, item_id); -- --- Name: index_log_bank_statements_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_bank_statements_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_bank_statements_on_whodunnit ON public.log_bank_statements USING btree (whodunnit); -- --- Name: index_log_bank_transactions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_bank_transactions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_bank_transactions_on_item_type_and_item_id ON public.log_bank_transactions USING btree (item_type, item_id); -- --- Name: index_log_bank_transactions_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_bank_transactions_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_bank_transactions_on_whodunnit ON public.log_bank_transactions USING btree (whodunnit); -- --- Name: index_log_blocked_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_blocked_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_blocked_domains_on_item_type_and_item_id ON public.log_blocked_domains USING btree (item_type, item_id); -- --- Name: index_log_blocked_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_blocked_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_blocked_domains_on_whodunnit ON public.log_blocked_domains USING btree (whodunnit); -- --- Name: index_log_certificates_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_certificates_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_certificates_on_item_type_and_item_id ON public.log_certificates USING btree (item_type, item_id); -- --- Name: index_log_certificates_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_certificates_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_certificates_on_whodunnit ON public.log_certificates USING btree (whodunnit); -- --- Name: index_log_contacts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_contacts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_contacts_on_item_type_and_item_id ON public.log_contacts USING btree (item_type, item_id); -- --- Name: index_log_contacts_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_contacts_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_contacts_on_whodunnit ON public.log_contacts USING btree (whodunnit); -- --- Name: index_log_dnskeys_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_dnskeys_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_dnskeys_on_item_type_and_item_id ON public.log_dnskeys USING btree (item_type, item_id); -- --- Name: index_log_dnskeys_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_dnskeys_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_dnskeys_on_whodunnit ON public.log_dnskeys USING btree (whodunnit); -- --- Name: index_log_domain_contacts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_domain_contacts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_domain_contacts_on_item_type_and_item_id ON public.log_domain_contacts USING btree (item_type, item_id); -- --- Name: index_log_domain_contacts_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_domain_contacts_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_domain_contacts_on_whodunnit ON public.log_domain_contacts USING btree (whodunnit); -- --- Name: index_log_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_domains_on_item_type_and_item_id ON public.log_domains USING btree (item_type, item_id); -- --- Name: index_log_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_domains_on_whodunnit ON public.log_domains USING btree (whodunnit); -- --- Name: index_log_invoice_items_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_invoice_items_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_invoice_items_on_item_type_and_item_id ON public.log_invoice_items USING btree (item_type, item_id); -- --- Name: index_log_invoice_items_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_invoice_items_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_invoice_items_on_whodunnit ON public.log_invoice_items USING btree (whodunnit); -- --- Name: index_log_invoices_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_invoices_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_invoices_on_item_type_and_item_id ON public.log_invoices USING btree (item_type, item_id); -- --- Name: index_log_invoices_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_invoices_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_invoices_on_whodunnit ON public.log_invoices USING btree (whodunnit); -- --- Name: index_log_nameservers_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_nameservers_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_nameservers_on_item_type_and_item_id ON public.log_nameservers USING btree (item_type, item_id); -- --- Name: index_log_nameservers_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_nameservers_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_nameservers_on_whodunnit ON public.log_nameservers USING btree (whodunnit); -- --- Name: index_log_notifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_notifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_notifications_on_item_type_and_item_id ON public.log_notifications USING btree (item_type, item_id); -- --- Name: index_log_notifications_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_notifications_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_notifications_on_whodunnit ON public.log_notifications USING btree (whodunnit); -- --- Name: index_log_registrant_verifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_registrant_verifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_registrant_verifications_on_item_type_and_item_id ON public.log_registrant_verifications USING btree (item_type, item_id); -- --- Name: index_log_registrant_verifications_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_registrant_verifications_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_registrant_verifications_on_whodunnit ON public.log_registrant_verifications USING btree (whodunnit); -- --- Name: index_log_registrars_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_registrars_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_registrars_on_item_type_and_item_id ON public.log_registrars USING btree (item_type, item_id); -- --- Name: index_log_registrars_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_registrars_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_registrars_on_whodunnit ON public.log_registrars USING btree (whodunnit); -- --- Name: index_log_reserved_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_reserved_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_reserved_domains_on_item_type_and_item_id ON public.log_reserved_domains USING btree (item_type, item_id); -- --- Name: index_log_reserved_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_reserved_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_reserved_domains_on_whodunnit ON public.log_reserved_domains USING btree (whodunnit); -- --- Name: index_log_settings_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_settings_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_settings_on_item_type_and_item_id ON public.log_settings USING btree (item_type, item_id); -- --- Name: index_log_settings_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_settings_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_settings_on_whodunnit ON public.log_settings USING btree (whodunnit); -- --- Name: index_log_users_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_users_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_users_on_item_type_and_item_id ON public.log_users USING btree (item_type, item_id); -- --- Name: index_log_users_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_users_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_users_on_whodunnit ON public.log_users USING btree (whodunnit); -- --- Name: index_nameservers_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_nameservers_on_domain_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_nameservers_on_domain_id ON public.nameservers USING btree (domain_id); -- --- Name: index_notifications_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_notifications_on_registrar_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_notifications_on_registrar_id ON public.notifications USING btree (registrar_id); -- --- Name: index_payment_orders_on_invoice_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_payment_orders_on_invoice_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_payment_orders_on_invoice_id ON public.payment_orders USING btree (invoice_id); -- --- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_prices_on_zone_id ON public.prices USING btree (zone_id); -- --- Name: index_registrant_verifications_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_registrant_verifications_on_created_at; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_registrant_verifications_on_created_at ON public.registrant_verifications USING btree (created_at); -- --- Name: index_registrant_verifications_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_registrant_verifications_on_domain_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_registrant_verifications_on_domain_id ON public.registrant_verifications USING btree (domain_id); -- --- Name: index_settings_on_thing_type_and_thing_id_and_var; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_settings_on_thing_type_and_thing_id_and_var; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_settings_on_thing_type_and_thing_id_and_var ON public.settings USING btree (thing_type, thing_id, var); -- --- Name: index_users_on_identity_code; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_users_on_identity_code; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_users_on_identity_code ON public.users USING btree (identity_code); -- --- Name: index_users_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_users_on_registrar_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_users_on_registrar_id ON public.users USING btree (registrar_id); -- --- Name: index_versions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_versions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_versions_on_item_type_and_item_id ON public.versions USING btree (item_type, item_id); -- --- Name: index_whois_records_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_whois_records_on_domain_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_whois_records_on_domain_id ON public.whois_records USING btree (domain_id); -- --- Name: index_whois_records_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_whois_records_on_registrar_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_whois_records_on_registrar_id ON public.whois_records USING btree (registrar_id); -- --- Name: log_contacts_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: log_contacts_object_legacy_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX log_contacts_object_legacy_id ON public.log_contacts USING btree ((((object ->> 'legacy_id'::text))::integer)); -- --- Name: log_dnskeys_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: log_dnskeys_object_legacy_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX log_dnskeys_object_legacy_id ON public.log_contacts USING btree ((((object ->> 'legacy_domain_id'::text))::integer)); -- --- Name: log_domains_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: log_domains_object_legacy_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX log_domains_object_legacy_id ON public.log_contacts USING btree ((((object ->> 'legacy_id'::text))::integer)); -- --- Name: log_nameservers_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: log_nameservers_object_legacy_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX log_nameservers_object_legacy_id ON public.log_contacts USING btree ((((object ->> 'legacy_domain_id'::text))::integer)); -- --- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX unique_schema_migrations ON public.schema_migrations USING btree (version); -- --- Name: contacts_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: contacts process_contact_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_contact_audit AFTER INSERT OR DELETE OR UPDATE ON public.contacts FOR EACH ROW EXECUTE PROCEDURE public.process_contact_audit(); + + +-- +-- Name: contacts contacts_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts @@ -3848,7 +3989,7 @@ ALTER TABLE ONLY public.contacts -- --- Name: domain_contacts_contact_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domain_contacts domain_contacts_contact_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_contacts @@ -3856,7 +3997,7 @@ ALTER TABLE ONLY public.domain_contacts -- --- Name: domain_contacts_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domain_contacts domain_contacts_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_contacts @@ -3864,7 +4005,7 @@ ALTER TABLE ONLY public.domain_contacts -- --- Name: domains_registrant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domains domains_registrant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domains @@ -3872,7 +4013,7 @@ ALTER TABLE ONLY public.domains -- --- Name: domains_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domains domains_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domains @@ -3880,7 +4021,7 @@ ALTER TABLE ONLY public.domains -- --- Name: fk_rails_242b91538b; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: invoices fk_rails_242b91538b; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoices @@ -3888,7 +4029,7 @@ ALTER TABLE ONLY public.invoices -- --- Name: fk_rails_36cff3de9c; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: white_ips fk_rails_36cff3de9c; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.white_ips @@ -3896,7 +4037,7 @@ ALTER TABLE ONLY public.white_ips -- --- Name: fk_rails_59c422f73d; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domain_transfers fk_rails_59c422f73d; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers @@ -3904,7 +4045,7 @@ ALTER TABLE ONLY public.domain_transfers -- --- Name: fk_rails_78c376257f; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: prices fk_rails_78c376257f; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.prices @@ -3912,7 +4053,7 @@ ALTER TABLE ONLY public.prices -- --- Name: fk_rails_833ed7f3c0; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domain_transfers fk_rails_833ed7f3c0; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers @@ -3920,7 +4061,7 @@ ALTER TABLE ONLY public.domain_transfers -- --- Name: fk_rails_86cd2b09f5; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: account_activities fk_rails_86cd2b09f5; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -3928,7 +4069,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: fk_rails_87b8e40c63; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domain_transfers fk_rails_87b8e40c63; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers @@ -3936,7 +4077,7 @@ ALTER TABLE ONLY public.domain_transfers -- --- Name: fk_rails_8c6b5c12eb; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: actions fk_rails_8c6b5c12eb; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.actions @@ -3944,7 +4085,7 @@ ALTER TABLE ONLY public.actions -- --- Name: fk_rails_8f9734b530; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: notifications fk_rails_8f9734b530; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.notifications @@ -3952,7 +4093,7 @@ ALTER TABLE ONLY public.notifications -- --- Name: fk_rails_a5ae3c203d; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: actions fk_rails_a5ae3c203d; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.actions @@ -3960,7 +4101,7 @@ ALTER TABLE ONLY public.actions -- --- Name: fk_rails_adff2dc8e3; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: epp_sessions fk_rails_adff2dc8e3; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.epp_sessions @@ -3968,7 +4109,7 @@ ALTER TABLE ONLY public.epp_sessions -- --- Name: fk_rails_b80dbb973d; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: account_activities fk_rails_b80dbb973d; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -3976,7 +4117,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: fk_rails_c9f635c0b3; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: accounts fk_rails_c9f635c0b3; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.accounts @@ -3984,7 +4125,7 @@ ALTER TABLE ONLY public.accounts -- --- Name: fk_rails_ce38d749f6; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: account_activities fk_rails_ce38d749f6; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -3992,7 +4133,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: fk_rails_d2cc3c2fa9; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: account_activities fk_rails_d2cc3c2fa9; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -4000,7 +4141,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: fk_rails_f41617a0e9; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: registrant_verifications fk_rails_f41617a0e9; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrant_verifications @@ -4008,7 +4149,7 @@ ALTER TABLE ONLY public.registrant_verifications -- --- Name: fk_rails_f9dc5857c3; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: payment_orders fk_rails_f9dc5857c3; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.payment_orders @@ -4016,7 +4157,7 @@ ALTER TABLE ONLY public.payment_orders -- --- Name: invoice_items_invoice_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: invoice_items invoice_items_invoice_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoice_items @@ -4024,7 +4165,7 @@ ALTER TABLE ONLY public.invoice_items -- --- Name: messages_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: notifications messages_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.notifications @@ -4032,7 +4173,7 @@ ALTER TABLE ONLY public.notifications -- --- Name: nameservers_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: nameservers nameservers_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.nameservers @@ -4040,7 +4181,7 @@ ALTER TABLE ONLY public.nameservers -- --- Name: user_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: users user_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users @@ -4463,5 +4604,10 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200130092113'), ('20200203143458'), ('20200204103125'), -('20200311114649'); +('20200310105731'), +('20200310105736'), +('20200311111515'), +('20200311114649'), +('20200421093637'); + diff --git a/lib/schemas/eis-1.0.xsd b/lib/schemas/eis-1.0.xsd index ddb3602c0..6a6bc742d 100644 --- a/lib/schemas/eis-1.0.xsd +++ b/lib/schemas/eis-1.0.xsd @@ -25,6 +25,7 @@ + @@ -49,6 +50,16 @@ + + + + + + + + diff --git a/lib/tasks/whois.rake b/lib/tasks/whois.rake index c38b2c5ba..52be7e17f 100644 --- a/lib/tasks/whois.rake +++ b/lib/tasks/whois.rake @@ -35,6 +35,11 @@ namespace :whois do ReservedDomain.find_in_batches.each do |group| UpdateWhoisRecordJob.enqueue group.map(&:name), 'reserved' end + + print "\n-----> Update disputed domains whois_records" + Dispute.active.find_in_batches.each do |group| + UpdateWhoisRecordJob.enqueue group.map(&:domain_name), 'disputed' + end end puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds" end From c3497ab46fe3cb9a47cce689db026e6bc224304e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 24 Apr 2020 16:05:41 +0300 Subject: [PATCH 03/43] Create views for domain disputing --- app/views/admin/disputes/_form.html.erb | 12 +++++++----- app/views/admin/disputes/edit.haml | 2 +- app/views/admin/disputes/index.haml | 11 ++++------- app/views/admin/settings/index.haml | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/views/admin/disputes/_form.html.erb b/app/views/admin/disputes/_form.html.erb index a234c17bc..38d5fbda2 100644 --- a/app/views/admin/disputes/_form.html.erb +++ b/app/views/admin/disputes/_form.html.erb @@ -10,6 +10,9 @@
+
+

As per domain law, expiry time is <%= Setting.dispute_period_in_months / 12 %> years ahead from start date.

+
<%= f.label :domain_name %> @@ -32,17 +35,16 @@ <%= f.label :starts_at %>
- <%= f.text_field(:starts_at, placeholder: t(:optional), class: 'form-control') %> - <%= t '.password_hint' %> + <%= f.text_field(:starts_at, class: 'form-control js-datepicker') %> + <%= t '.in_future' %>
- <%= f.label :expires_at %> + <%= f.label :comment %>
- <%= f.text_field(:expires_at, placeholder: t(:optional), class: 'form-control') %> - <%= t '.password_hint' %> + <%= f.text_field(:comment, placeholder: t(:optional), class: 'form-control') %>
diff --git a/app/views/admin/disputes/edit.haml b/app/views/admin/disputes/edit.haml index 51d77f0cc..966976891 100644 --- a/app/views/admin/disputes/edit.haml +++ b/app/views/admin/disputes/edit.haml @@ -1,3 +1,3 @@ -= render 'shared/title', name: t(:edit_pw) += render 'shared/title', name: t(:edit_dispute) = render 'form' diff --git a/app/views/admin/disputes/index.haml b/app/views/admin/disputes/index.haml index 63438ad9e..86ba2a093 100644 --- a/app/views/admin/disputes/index.haml +++ b/app/views/admin/disputes/index.haml @@ -40,14 +40,12 @@ = sort_link(@q, 'name') %th{class: 'col-xs-2'} = sort_link(@q, 'password') + %th{class: 'col-xs-2'} + = sort_link(@q, 'starts_at') %th{class: 'col-xs-2'} = sort_link(@q, 'expires_at') %th{class: 'col-xs-2'} = sort_link(@q, 'comment') - %th{class: 'col-xs-2'} - = sort_link(@q, 'created_at', t(:created_at)) - %th{class: 'col-xs-2'} - = sort_link(@q, 'updated_at', t(:updated_at)) %th{class: 'col-xs-2'} = t(:actions) %tbody @@ -55,12 +53,11 @@ %tr %td= x.domain_name %td= x.password + %td= x.starts_at %td= x.expires_at %td= x.comment - %td= l(x.created_at, format: :short) - %td= l(x.updated_at, format: :short) %td - = link_to(t(:edit_pw), edit_admin_dispute_path(id: x.id), + = link_to(t(:edit), edit_admin_dispute_path(id: x.id), class: 'btn btn-primary btn-xs') = link_to(t(:delete), delete_admin_dispute_path(id: x.id), data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') diff --git a/app/views/admin/settings/index.haml b/app/views/admin/settings/index.haml index 23f87c4b2..977f81202 100644 --- a/app/views/admin/settings/index.haml +++ b/app/views/admin/settings/index.haml @@ -48,7 +48,7 @@ = render 'setting_row', var: :request_confrimation_on_registrant_change_enabled = render 'setting_row', var: :request_confirmation_on_domain_deletion_enabled = render 'setting_row', var: :address_processing - + = render 'setting_row', var: :dispute_period_in_months %tr %td.col-md-6= label_tag :default_language %td.col-md-6 From 42946dfa15ede2cbda5adfdb6ab773a18f6b0761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 27 Apr 2020 10:56:27 +0300 Subject: [PATCH 04/43] Add closed disputed sections to disputes view --- app/controllers/admin/disputes_controller.rb | 8 +- app/models/dispute.rb | 17 +- app/views/admin/disputes/index.haml | 69 ------- app/views/admin/disputes/index.html.erb | 182 +++++++++++++++++++ 4 files changed, 202 insertions(+), 74 deletions(-) delete mode 100644 app/views/admin/disputes/index.haml create mode 100644 app/views/admin/disputes/index.html.erb diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 8d26db614..25bb41bf8 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -8,10 +8,16 @@ module Admin # GET /admin/disputes def index params[:q] ||= {} - disputes = Dispute.all.order(:domain_name) + disputes = Dispute.active.all.order(:domain_name) + @q = disputes.search(params[:q]) @disputes = @q.result.page(params[:page]) @disputes = @disputes.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? + + closed_disputes = Dispute.closed.order(:domain_name) + @closed_q = closed_disputes.search(params[:closed_q]) + @closed_disputes = @closed_q.result.page(params[:closed_page]) + @closed_disputes = @closed_disputes.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? end # GET /admin/disputes/1 diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 450a92a2b..a1fa45501 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -2,10 +2,10 @@ class Dispute < ApplicationRecord validates :domain_name, :password, :starts_at, :expires_at, presence: true - validates_uniqueness_of :domain_name, case_sensitive: true before_validation :fill_empty_passwords before_validation :set_expiry_date - validate :validate_domain_name + validate :validate_domain_name_format + validate :validate_domain_name_period_uniqueness with_options on: :admin do validate :validate_start_date @@ -15,7 +15,7 @@ class Dispute < ApplicationRecord after_destroy :remove_data scope :expired, -> { where('expires_at < ?', Time.zone.today) } - scope :active, -> { where('expires_at > ? AND closed = 0', Time.zone.today) } + scope :active, -> { where('expires_at > ? AND closed = false', Time.zone.today) } scope :closed, -> { where(closed: true) } alias_attribute :name, :domain_name @@ -78,7 +78,7 @@ class Dispute < ApplicationRecord errors.add(:starts_at, :past) if starts_at.past? end - def validate_domain_name + def validate_domain_name_format return unless domain_name zone = domain_name.split('.').last @@ -86,4 +86,13 @@ class Dispute < ApplicationRecord errors.add(:domain_name, :unsupported_zone) unless supported_zone end + + def validate_domain_name_period_uniqueness + return unless new_record? + + existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: false).where('expires_at > ?', starts_at) + return unless existing_dispute.any? + + errors.add(:base, 'Dispute already exists for this domain at given timeframe') + end end diff --git a/app/views/admin/disputes/index.haml b/app/views/admin/disputes/index.haml deleted file mode 100644 index 86ba2a093..000000000 --- a/app/views/admin/disputes/index.haml +++ /dev/null @@ -1,69 +0,0 @@ -- content_for :actions do - = link_to(t('.new_btn'), new_admin_dispute_path, class: 'btn btn-primary') -= render 'shared/title', name: t('.title') - -.row - .col-md-12 - = search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f| - .row - .col-md-3 - .form-group - = f.label :name - = f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) - .col-md-3 - .form-group - = f.label t(:created_at_from) - = f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_at_from) - .col-md-3 - .form-group - = f.label t(:created_at_until) - = f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_at_until) - .row - .col-md-3 - .form-group - = label_tag t(:results_per_page) - = text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) - .col-md-3{style: 'padding-top: 25px;'} - %button.btn.btn-primary -   - %span.glyphicon.glyphicon-search -   - = link_to(t('.reset_btn'), admin_disputes_path, class: 'btn btn-default') -%hr -.row - .col-md-12 - .table-responsive - %table.table.table-hover.table-bordered.table-condensed - %thead - %tr - %th{class: 'col-xs-2'} - = sort_link(@q, 'name') - %th{class: 'col-xs-2'} - = sort_link(@q, 'password') - %th{class: 'col-xs-2'} - = sort_link(@q, 'starts_at') - %th{class: 'col-xs-2'} - = sort_link(@q, 'expires_at') - %th{class: 'col-xs-2'} - = sort_link(@q, 'comment') - %th{class: 'col-xs-2'} - = t(:actions) - %tbody - - @disputes.each do |x| - %tr - %td= x.domain_name - %td= x.password - %td= x.starts_at - %td= x.expires_at - %td= x.comment - %td - = link_to(t(:edit), edit_admin_dispute_path(id: x.id), - class: 'btn btn-primary btn-xs') - = link_to(t(:delete), delete_admin_dispute_path(id: x.id), - data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs') -.row - .col-md-6 - = paginate @disputes - .col-md-6.text-right - .pagination - = t(:result_count, count: @disputes.total_count) diff --git a/app/views/admin/disputes/index.html.erb b/app/views/admin/disputes/index.html.erb new file mode 100644 index 000000000..eea74f59a --- /dev/null +++ b/app/views/admin/disputes/index.html.erb @@ -0,0 +1,182 @@ +<% content_for :actions do %> +<%= link_to(t('.new_btn'), new_admin_dispute_path, class: 'btn btn-primary') %> +<% end %> +<%= render 'shared/title', name: t('.title') %> +
+
+ <%= search_form_for [:admin, @q], html: { style: 'margin-bottom: 0;', class: 'js-form', autocomplete: 'off' } do |f| %> +
+
+
+ <%= f.label :name %> + <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %> +
+
+
+
+ <%= f.label t(:created_at_from) %> + <%= f.search_field :created_at_gteq, value: params[:q][:created_at_gteq], class: 'form-control js-datepicker', placeholder: t(:created_at_from) %> +
+
+
+
+ <%= f.label t(:created_at_until) %> + <%= f.search_field :created_at_lteq, value: params[:q][:created_at_lteq], class: 'form-control js-datepicker', placeholder: t(:created_at_until) %> +
+
+
+
+
+
+ <%= label_tag t(:results_per_page) %> + <%= text_field_tag :results_per_page, params[:results_per_page], class: 'form-control', placeholder: t(:results_per_page) %> +
+
+
+ + <%= link_to(t('.reset_btn'), admin_disputes_path, class: 'btn btn-default') %> +
+
+ <% end %> +
+
+
+

Active disputes

+
+
+
+ + + + + + + + + + + + + <% @disputes.each do |x| %> + + + + + + + + + <% end %> + +
+ <%= sort_link(@q, 'name') %> + + <%= sort_link(@q, 'password') %> + + <%= sort_link(@q, 'starts_at') %> + + <%= sort_link(@q, 'expires_at') %> + + <%= sort_link(@q, 'comment') %> + + <%= t(:actions) %> +
+ <%= x.domain_name %> + + <%= x.password %> + + <%= x.starts_at %> + + <%= x.expires_at %> + + <%= x.comment %> + + <%= link_to t(:edit), edit_admin_dispute_path(id: x.id), + class: 'btn btn-primary btn-xs' %> + <%= link_to t(:delete), delete_admin_dispute_path(id: x.id), + data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs' %> +
+
+
+
+
+
+ <%= paginate @disputes %> +
+
+ +
+
+
+

Expired / Closed disputes

+
+
+
+ + + + + + + + + + + + + <% @closed_disputes.each do |x| %> + + + + + + + + + <% end %> + +
+ <%= sort_link(@q, 'name') %> + + <%= sort_link(@q, 'password') %> + + <%= sort_link(@q, 'starts_at') %> + + <%= sort_link(@q, 'expires_at') %> + + <%= sort_link(@q, 'comment') %> + + <%= t(:actions) %> +
+ <%= x.domain_name %> + + <%= x.password %> + + <%= x.starts_at %> + + <%= x.expires_at %> + + <%= x.comment %> + + <%= link_to t(:delete), delete_admin_dispute_path(id: x.id), + data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs' %> +
+
+
+
+
+
+ <%= paginate @closed_disputes %> +
+
+ +
+
From 25d78cde74fb2fa0625c5bd80e3a8b8def0f6b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 27 Apr 2020 12:22:31 +0300 Subject: [PATCH 05/43] Fix some code styling issues --- app/controllers/admin/disputes_controller.rb | 10 +++++--- .../domain_update_confirms_controller.rb | 1 - app/models/dispute.rb | 3 ++- app/models/epp/domain.rb | 24 +++++++++++-------- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 25bb41bf8..1435081e5 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -3,7 +3,7 @@ module Admin class DisputesController < BaseController load_and_authorize_resource - before_action :set_dispute, only: %i[show edit update destroy] + before_action :set_dispute, only: %i[show edit update delete] # GET /admin/disputes def index @@ -12,12 +12,16 @@ module Admin @q = disputes.search(params[:q]) @disputes = @q.result.page(params[:page]) - @disputes = @disputes.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? + if params[:results_per_page].to_i.positive? + @disputes = @disputes.per(params[:results_per_page]) + end closed_disputes = Dispute.closed.order(:domain_name) @closed_q = closed_disputes.search(params[:closed_q]) @closed_disputes = @closed_q.result.page(params[:closed_page]) - @closed_disputes = @closed_disputes.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? + return unless params[:results_per_page].to_i.positive? + + @closed_disputes = @closed_disputes.per(params[:results_per_page]) end # GET /admin/disputes/1 diff --git a/app/controllers/registrant/domain_update_confirms_controller.rb b/app/controllers/registrant/domain_update_confirms_controller.rb index 83b7ee953..0b964ae2b 100644 --- a/app/controllers/registrant/domain_update_confirms_controller.rb +++ b/app/controllers/registrant/domain_update_confirms_controller.rb @@ -32,7 +32,6 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController elsif params[:confirmed] if @registrant_verification.domain_registrant_change_confirm!("email link, #{initiator}") if @domain.disputed? - Rails.logger.info 'Closing domain dispute via RegistrantConfirmation' dispute = Dispute.active.find_by(domain_name: @domain.name) dispute.close end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index a1fa45501..99777fa82 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -90,7 +90,8 @@ class Dispute < ApplicationRecord def validate_domain_name_period_uniqueness return unless new_record? - existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: false).where('expires_at > ?', starts_at) + existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: false) + .where('expires_at > ?', starts_at) return unless existing_dispute.any? errors.add(:base, 'Dispute already exists for this domain at given timeframe') diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 31fee711d..3c687ea36 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -53,13 +53,13 @@ class Epp::Domain < Domain def epp_code_map { '2002' => [ # Command use error - [:base, :domain_already_belongs_to_the_querying_registrar] + %i[base domain_already_belongs_to_the_querying_registrar] ], '2003' => [ # Required parameter missing - [:registrant, :blank], - [:registrar, :blank], - [:base, :required_parameter_missing_reserved], - [:base, :required_parameter_missing_disputed] + %i[registrant blank], + %i[registrar blank], + %i[base required_parameter_missing_reserved], + %i[base required_parameter_missing_disputed], ], '2004' => [ # Parameter value range error [:dnskeys, :out_of_range, @@ -86,11 +86,11 @@ class Epp::Domain < Domain [:puny_label, :too_long, { obj: 'name', val: name_puny }] ], '2201' => [ # Authorisation error - [:transfer_code, :wrong_pw] + %i[transfer_code wrong_pw] ], '2202' => [ - [:base, :invalid_auth_information_reserved], - [:base, :invalid_auth_information_disputed] + %i[base invalid_auth_information_reserved], + %i[base invalid_auth_information_disputed], ], '2302' => [ # Object exists [:name_dirty, :taken, { value: { obj: 'name', val: name_dirty } }], @@ -481,10 +481,14 @@ class Epp::Domain < Domain if !same_registrant_as_current && disputed? disputed_pw = frame.css('disputed > pw').text if disputed_pw.blank? - add_epp_error('2304', nil, nil, 'Required parameter missing; disputed pw element required for dispute domains') + add_epp_error('2304', nil, nil, 'Required parameter missing; disputed' \ + 'pw element required for dispute domains') else dispute = Dispute.active.find_by(domain_name: name, password: disputed_pw) - add_epp_error('2202', nil, nil, 'Invalid authorization information; invalid disputed>pw value') if dispute.nil? + if dispute.nil? + add_epp_error('2202', nil, nil, 'Invalid authorization information; '\ + 'invalid disputed>pw value') + end end end From 2c8f1081c9327420cc2589dacfc39eaa66e2aa84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 27 Apr 2020 12:23:10 +0300 Subject: [PATCH 06/43] Remove useless properties from SQL structure --- db/structure.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index 2e8294d41..6b690e04e 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1,13 +1,11 @@ SET statement_timeout = 0; SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; -SET row_security = off; -- -- Name: audit; Type: SCHEMA; Schema: -; Owner: - From 39791f5755302c40e632a6c32c6a73386a8ecbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 27 Apr 2020 12:32:55 +0300 Subject: [PATCH 07/43] Fix styling issues --- app/controllers/admin/disputes_controller.rb | 24 ++++++------- app/controllers/epp/domains_controller.rb | 21 ++++-------- .../domain_delete_confirms_controller.rb | 34 ++++++++++--------- app/models/dispute.rb | 5 +++ app/models/epp/domain.rb | 4 +-- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 1435081e5..82b48149b 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -8,20 +8,8 @@ module Admin # GET /admin/disputes def index params[:q] ||= {} - disputes = Dispute.active.all.order(:domain_name) - - @q = disputes.search(params[:q]) - @disputes = @q.result.page(params[:page]) - if params[:results_per_page].to_i.positive? - @disputes = @disputes.per(params[:results_per_page]) - end - - closed_disputes = Dispute.closed.order(:domain_name) - @closed_q = closed_disputes.search(params[:closed_q]) - @closed_disputes = @closed_q.result.page(params[:closed_page]) - return unless params[:results_per_page].to_i.positive? - - @closed_disputes = @closed_disputes.per(params[:results_per_page]) + @disputes = sortable_dispute_query_for(Dispute.active.all, params[:q]) + @closed_disputes = sortable_dispute_query_for(Dispute.closed.all, params[:q]) end # GET /admin/disputes/1 @@ -62,6 +50,14 @@ module Admin private + def sortable_dispute_query_for(disputes, query) + @q = disputes.order(:domain_name).search(query) + disputes = @q.result.page(params[:page]) + return disputes.per(params[:results_per_page]) if params[:results_per_page].present? + + disputes + end + # Use callbacks to share common setup or constraints between actions. def set_dispute @dispute = Dispute.find(params[:id]) diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 2ab1f6d3a..9a162a455 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -103,25 +103,18 @@ module Epp def update authorize! :update, @domain, @password - if @domain.update(params[:parsed_frame], current_user) - if @domain.disputed? - dispute = Dispute.active.find_by(domain_name: @domain.name) - dispute.close - end - if @domain.epp_pending_update.present? - render_epp_response '/epp/domains/success_pending' - else - render_epp_response '/epp/domains/success' - end - else - handle_errors(@domain) - end + updated = @domain.update(params[:parsed_frame], current_user) + (handle_errors(@domain) && return) unless updated + + Dispute.active.close_by_domain(@domain.name) if @domain.disputed? + pending = @domain.epp_pending_update.present? + render_epp_response "/epp/domains/success#{'_pending' if pending}" end def delete authorize! :delete, @domain, @password - handle_errors(@domain) and return unless @domain.can_be_deleted? + (handle_errors(@domain) && return) unless @domain.can_be_deleted? if @domain.epp_destroy(params[:parsed_frame], current_user.id) if @domain.epp_pending_delete.present? diff --git a/app/controllers/registrant/domain_delete_confirms_controller.rb b/app/controllers/registrant/domain_delete_confirms_controller.rb index 95eefc368..ba5dd2ba7 100644 --- a/app/controllers/registrant/domain_delete_confirms_controller.rb +++ b/app/controllers/registrant/domain_delete_confirms_controller.rb @@ -4,6 +4,7 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController def show return if params[:confirmed] || params[:rejected] + @domain = Domain.find(params[:id]) @domain = nil unless @domain.registrant_delete_confirmable?(params[:token]) end @@ -21,22 +22,23 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController initiator = current_registrant_user ? current_registrant_user.username : t(:user_not_authenticated) - if params[:rejected] - if @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}") - flash[:notice] = t(:registrant_domain_verification_rejected) - redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true) - else - flash[:alert] = t(:registrant_domain_delete_rejected_failed) - return render 'show' - end - elsif params[:confirmed] - if @registrant_verification.domain_registrant_delete_confirm!("email link #{initiator}") - flash[:notice] = t(:registrant_domain_verification_confirmed) - redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true) - else - flash[:alert] = t(:registrant_domain_delete_confirmed_failed) - return render 'show' - end + confirmed = params[:confirmed] ? true : false + action = if confirmed + @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}") + else + @registrant_verification.domain_registrant_delete_confirm!("email link #{initiator}") + end + + fail_msg = t("registrant_domain_delete_#{confirmed ? 'confirmed' : 'rejected'}_failed".to_sym) + success_msg = t("registrant_domain_verification_#{confirmed ? 'confirmed' : 'rejected'}".to_sym) + + flash[:alert] = action ? success_msg : fail_msg + (render 'show' && return) unless action + + if confirmed + redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true) && return + else + redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true) unless confirmed end end end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 99777fa82..e4d27aeb8 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -20,6 +20,11 @@ class Dispute < ApplicationRecord alias_attribute :name, :domain_name + def self.close_by_domain(domain_name) + dispute = Dispute.active.find_by(domain_name: domain_name) + dispute.update(closed: true) if dispute.present? + end + def set_expiry_date return if starts_at.blank? diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 3c687ea36..17046a8f1 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -53,7 +53,7 @@ class Epp::Domain < Domain def epp_code_map { '2002' => [ # Command use error - %i[base domain_already_belongs_to_the_querying_registrar] + %i[base domain_already_belongs_to_the_querying_registrar], ], '2003' => [ # Required parameter missing %i[registrant blank], @@ -86,7 +86,7 @@ class Epp::Domain < Domain [:puny_label, :too_long, { obj: 'name', val: name_puny }] ], '2201' => [ # Authorisation error - %i[transfer_code wrong_pw] + %i[transfer_code wrong_pw], ], '2202' => [ %i[base invalid_auth_information_reserved], From cca7745c641c8766a40bc45ec74aa5ee7e0e7f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 27 Apr 2020 18:24:08 +0300 Subject: [PATCH 08/43] Improve WhoisRecord create/update for disputed domain --- app/jobs/update_whois_record_job.rb | 11 ++++++++--- app/models/dispute.rb | 29 ++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/jobs/update_whois_record_job.rb b/app/jobs/update_whois_record_job.rb index cd35823e6..0642aed8d 100644 --- a/app/jobs/update_whois_record_job.rb +++ b/app/jobs/update_whois_record_job.rb @@ -1,13 +1,13 @@ class UpdateWhoisRecordJob < Que::Job def run(names, type) - ::PaperTrail.whodunnit = "job - #{self.class.name} - #{type}" + ::PaperTrail.request.whodunnit = "job - #{self.class.name} - #{type}" klass = case type when 'reserved' then ReservedDomain when 'blocked' then BlockedDomain when 'domain' then Domain - when 'disputed' then Dispute + when 'disputed' then Dispute.active end Array(names).each do |name| @@ -56,6 +56,11 @@ class UpdateWhoisRecordJob < Que::Job end def delete_disputed(name) - delete_reserved(name) + return if Dispute.active.find_by(domain_name: name).present? + + Whois::Record.where(name: name).each do |r| + r.json['status'] = r.json['status'].delete_if { |status| status == 'disputed' } + r.save! + end end end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index e4d27aeb8..42ea9ff79 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -12,6 +12,7 @@ class Dispute < ApplicationRecord end before_save :set_expiry_date before_save :sync_reserved_password + before_save :generate_data after_destroy :remove_data scope :expired, -> { where('expires_at < ?', Time.zone.today) } @@ -36,23 +37,33 @@ class Dispute < ApplicationRecord end def generate_data - return if Domain.where(name: domain_name).any? - wr = Whois::Record.find_or_initialize_by(name: domain_name) - wr.json = @json = generate_json # we need @json to bind to class - wr.save + if Domain.where(name: domain_name).any? + @json = wr.json.with_indifferent_access + @json[:status] << 'disputed' unless @json[:status].include? 'disputed' + wr.json = @json + else + wr.json = @json = generate_json(wr) # we need @json to bind to class + end + wr.save! end + alias_method :update_whois_record, :generate_data + def close self.closed = true save! end - def generate_json - h = HashWithIndifferentAccess.new - h[:name] = domain_name - h[:status] = ['Disputed'] - h + def generate_json(record) + h = HashWithIndifferentAccess.new(name: domain_name, status: ['disputed']) + return h if record.json.empty? + + status_arr = (record.json['status'] ||= []) + status_arr.push('disputed') unless status_arr.include? 'disputed' + + record.json['status'] = status_arr + record.json end def remove_data From 26e7fd870c5964a1ecfea2d7f352500d4d86f4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 29 Apr 2020 15:44:52 +0300 Subject: [PATCH 09/43] Apply dispute statusses via DisputeStatusUpdateJob --- app/jobs/dispute_status_update_job.rb | 67 +++++++++++++++++++++++++++ app/jobs/update_whois_record_job.rb | 2 +- app/models/dispute.rb | 42 ++++++++++++----- 3 files changed, 99 insertions(+), 12 deletions(-) create mode 100644 app/jobs/dispute_status_update_job.rb diff --git a/app/jobs/dispute_status_update_job.rb b/app/jobs/dispute_status_update_job.rb new file mode 100644 index 000000000..5f8f1c6b1 --- /dev/null +++ b/app/jobs/dispute_status_update_job.rb @@ -0,0 +1,67 @@ +class DisputeStatusUpdateJob < Que::Job + def run + @backlog = { activated: 0, closed: 0, active_fail: [], close_fail: [] } + + close_disputes + activate_disputes + + Rails.logger.info "DisputeStatusCloseJob - All done. Closed #{@backlog[:closed]} and " \ + "activated #{@backlog[:closed]} disputes." + + show_failed_disputes unless @backlog[:active_fail].empty? && @backlog[:close_fail].empty? + end + + def close_disputes + disputes = Dispute.where(closed: false).where('expires_at < ?', Date.today).all + Rails.logger.info "DisputeStatusCloseJob - Found #{disputes.count} closable disputes" + disputes.each do |dispute| + puts "attempnt" + close_dispute(dispute) + end + end + + def activate_disputes + disputes = Dispute.where(closed: false, starts_at: Date.today).all + Rails.logger.info "DisputeStatusCloseJob - Found #{disputes.count} activatable disputes" + + disputes.each do |dispute| + activate_dispute(dispute) + end + end + + def close_dispute(dispute) + if dispute.close + Rails.logger.info 'DisputeStatusCloseJob - Closed dispute ' \ + "##{dispute.id} for '#{dispute.domain_name}'" + @backlog[:closed] += 1 + else + Rails.logger.info 'DisputeStatusCloseJob - Failed to close dispute ' \ + "##{dispute.id} for '#{dispute.domain_name}'" + @backlog[:close_fail] << dispute.id + end + end + + def activate_dispute(dispute) + if dispute.generate_data + Rails.logger.info 'DisputeStatusCloseJob - Activated dispute ' \ + "##{dispute.id} for '#{dispute.domain_name}'" + @backlog[:activated] += 1 + else + Rails.logger.info 'DisputeStatusCloseJob - Failed to activate dispute ' \ + "##{dispute.id} for '#{dispute.domain_name}'" + @backlog[:active_fail] << dispute.id + end + end + + def show_failed_disputes + if @backlog[:close_fail].any? + Rails.logger.info('DisputeStatuseCloseJob - Failed to close disputes with Ids:' \ + "#{@backlog[:close_fail]}") + end + + return unless @backlog[:active_fail].any? + + Rails.logger.info('DisputeStatuseCloseJob - Failed to activate disputes with Ids:' \ + "#{@backlog[:active_fail]}") + end +end diff --git a/app/jobs/update_whois_record_job.rb b/app/jobs/update_whois_record_job.rb index 0642aed8d..4740a12cb 100644 --- a/app/jobs/update_whois_record_job.rb +++ b/app/jobs/update_whois_record_job.rb @@ -60,7 +60,7 @@ class UpdateWhoisRecordJob < Que::Job Whois::Record.where(name: name).each do |r| r.json['status'] = r.json['status'].delete_if { |status| status == 'disputed' } - r.save! + r.json['status'].blank? ? r.destroy : r.save end end end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 42ea9ff79..a548ba7b5 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -15,8 +15,8 @@ class Dispute < ApplicationRecord before_save :generate_data after_destroy :remove_data - scope :expired, -> { where('expires_at < ?', Time.zone.today) } - scope :active, -> { where('expires_at > ? AND closed = false', Time.zone.today) } + scope :expired, -> { where('expires_at < ?', Date.today) } + scope :active, -> { where('expires_at > ? AND closed = false', Date.today) } scope :closed, -> { where(closed: true) } alias_attribute :name, :domain_name @@ -26,6 +26,10 @@ class Dispute < ApplicationRecord dispute.update(closed: true) if dispute.present? end + def for_active_domain? + Domain.where(name: domain_name).any? + end + def set_expiry_date return if starts_at.blank? @@ -37,27 +41,43 @@ class Dispute < ApplicationRecord end def generate_data + return if starts_at > Date.today + wr = Whois::Record.find_or_initialize_by(name: domain_name) - if Domain.where(name: domain_name).any? - @json = wr.json.with_indifferent_access - @json[:status] << 'disputed' unless @json[:status].include? 'disputed' - wr.json = @json + if for_active_domain? + wr.json['status'] << 'disputed' unless wr.json['status'].include? 'disputed' else - wr.json = @json = generate_json(wr) # we need @json to bind to class + wr.json = generate_json(wr) # we need @json to bind to class end - wr.save! + wr.save end alias_method :update_whois_record, :generate_data def close - self.closed = true - save! + return false unless update(closed: true) + return if Dispute.active.where(domain_name: domain_name).any? + + puts "PASS" + whois_record = Whois::Record.find_or_initialize_by(name: domain_name) + return true if remove_whois_data(whois_record) + + false + end + + def remove_whois_data(record) + record.json['status'] = record.json['status'].delete_if { |status| status == 'disputed' } + if record.json['status'].blank? + return true if record.destroy + + return false + end + record.save end def generate_json(record) h = HashWithIndifferentAccess.new(name: domain_name, status: ['disputed']) - return h if record.json.empty? + return h if record.json.blank? status_arr = (record.json['status'] ||= []) status_arr.push('disputed') unless status_arr.include? 'disputed' From b2c2342d7d2496d3450f3f8567c20ee1cdf6178c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 29 Apr 2020 15:51:10 +0300 Subject: [PATCH 10/43] Clear CC issues --- app/jobs/dispute_status_update_job.rb | 5 ++--- app/models/dispute.rb | 7 +++---- app/models/domain.rb | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/jobs/dispute_status_update_job.rb b/app/jobs/dispute_status_update_job.rb index 5f8f1c6b1..c6d048045 100644 --- a/app/jobs/dispute_status_update_job.rb +++ b/app/jobs/dispute_status_update_job.rb @@ -12,16 +12,15 @@ class DisputeStatusUpdateJob < Que::Job end def close_disputes - disputes = Dispute.where(closed: false).where('expires_at < ?', Date.today).all + disputes = Dispute.where(closed: false).where('expires_at < ?', Time.zone.today).all Rails.logger.info "DisputeStatusCloseJob - Found #{disputes.count} closable disputes" disputes.each do |dispute| - puts "attempnt" close_dispute(dispute) end end def activate_disputes - disputes = Dispute.where(closed: false, starts_at: Date.today).all + disputes = Dispute.where(closed: false, starts_at: Time.zone.today).all Rails.logger.info "DisputeStatusCloseJob - Found #{disputes.count} activatable disputes" disputes.each do |dispute| diff --git a/app/models/dispute.rb b/app/models/dispute.rb index a548ba7b5..754fc4208 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -15,8 +15,8 @@ class Dispute < ApplicationRecord before_save :generate_data after_destroy :remove_data - scope :expired, -> { where('expires_at < ?', Date.today) } - scope :active, -> { where('expires_at > ? AND closed = false', Date.today) } + scope :expired, -> { where('expires_at < ?', Time.zone.today) } + scope :active, -> { where('expires_at > ? AND closed = false', Time.zone.today) } scope :closed, -> { where(closed: true) } alias_attribute :name, :domain_name @@ -41,7 +41,7 @@ class Dispute < ApplicationRecord end def generate_data - return if starts_at > Date.today + return if starts_at > Time.zone.today wr = Whois::Record.find_or_initialize_by(name: domain_name) if for_active_domain? @@ -58,7 +58,6 @@ class Dispute < ApplicationRecord return false unless update(closed: true) return if Dispute.active.where(domain_name: domain_name).any? - puts "PASS" whois_record = Whois::Record.find_or_initialize_by(name: domain_name) return true if remove_whois_data(whois_record) diff --git a/app/models/domain.rb b/app/models/domain.rb index 011d02ec7..229e806fb 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -294,7 +294,7 @@ class Domain < ApplicationRecord def renewable? if Setting.days_to_renew_domain_before_expire != 0 # if you can renew domain at days_to_renew before domain expiration - if (expire_time.to_date - Date.today) + 1 > Setting.days_to_renew_domain_before_expire + if (expire_time.to_date - Time.zone.today) + 1 > Setting.days_to_renew_domain_before_expire return false end end From b4b43afa56ac8d5eb8a30f556c40879809afe5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 29 Apr 2020 16:24:35 +0300 Subject: [PATCH 11/43] Reduce complexity for dispute whois generation --- app/models/dispute.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 754fc4208..b9cabdeaa 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -26,10 +26,6 @@ class Dispute < ApplicationRecord dispute.update(closed: true) if dispute.present? end - def for_active_domain? - Domain.where(name: domain_name).any? - end - def set_expiry_date return if starts_at.blank? @@ -44,11 +40,7 @@ class Dispute < ApplicationRecord return if starts_at > Time.zone.today wr = Whois::Record.find_or_initialize_by(name: domain_name) - if for_active_domain? - wr.json['status'] << 'disputed' unless wr.json['status'].include? 'disputed' - else - wr.json = generate_json(wr) # we need @json to bind to class - end + wr.json = generate_json(wr) wr.save end @@ -75,12 +67,12 @@ class Dispute < ApplicationRecord end def generate_json(record) + status_arr = (record.json['status'] ||= []) h = HashWithIndifferentAccess.new(name: domain_name, status: ['disputed']) return h if record.json.blank? + return record.json if status_arr.include? 'disputed' - status_arr = (record.json['status'] ||= []) - status_arr.push('disputed') unless status_arr.include? 'disputed' - + status_arr.push('disputed') record.json['status'] = status_arr record.json end From 6f95925e996077e8221e7e49605b21bbd20da7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 29 Apr 2020 16:42:34 +0300 Subject: [PATCH 12/43] Eliminate duplicated code from dispute update job --- app/jobs/dispute_status_update_job.rb | 48 ++++++++++++--------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/app/jobs/dispute_status_update_job.rb b/app/jobs/dispute_status_update_job.rb index c6d048045..c1cca5a78 100644 --- a/app/jobs/dispute_status_update_job.rb +++ b/app/jobs/dispute_status_update_job.rb @@ -1,54 +1,48 @@ class DisputeStatusUpdateJob < Que::Job def run - @backlog = { activated: 0, closed: 0, active_fail: [], close_fail: [] } + @backlog = { 'activated': 0, 'closed': 0, 'activate_fail': [], 'close_fail': [] } close_disputes activate_disputes - Rails.logger.info "DisputeStatusCloseJob - All done. Closed #{@backlog[:closed]} and " \ + Rails.logger.info "DisputeStatusUpdateJob - All done. Closed #{@backlog[:closed]} and " \ "activated #{@backlog[:closed]} disputes." - show_failed_disputes unless @backlog[:active_fail].empty? && @backlog[:close_fail].empty? + show_failed_disputes unless @backlog[:activate_fail].empty? && @backlog[:close_fail].empty? end def close_disputes disputes = Dispute.where(closed: false).where('expires_at < ?', Time.zone.today).all - Rails.logger.info "DisputeStatusCloseJob - Found #{disputes.count} closable disputes" + Rails.logger.info "DisputeStatusUpdateJob - Found #{disputes.count} closable disputes" disputes.each do |dispute| - close_dispute(dispute) + process_dispute(dispute, closing: true) end end def activate_disputes disputes = Dispute.where(closed: false, starts_at: Time.zone.today).all - Rails.logger.info "DisputeStatusCloseJob - Found #{disputes.count} activatable disputes" + Rails.logger.info "DisputeStatusUpdateJob - Found #{disputes.count} activatable disputes" disputes.each do |dispute| - activate_dispute(dispute) + process_dispute(dispute, closing: false) end end - def close_dispute(dispute) - if dispute.close - Rails.logger.info 'DisputeStatusCloseJob - Closed dispute ' \ - "##{dispute.id} for '#{dispute.domain_name}'" - @backlog[:closed] += 1 - else - Rails.logger.info 'DisputeStatusCloseJob - Failed to close dispute ' \ - "##{dispute.id} for '#{dispute.domain_name}'" - @backlog[:close_fail] << dispute.id - end + def process_dispute(dispute, closing: false) + intent = closing ? 'close' : 'activate' + success = closing ? dispute.close : dispute.generate_data + create_backlog_entry(dispute: dispute, intent: intent, successful: success) end - def activate_dispute(dispute) - if dispute.generate_data - Rails.logger.info 'DisputeStatusCloseJob - Activated dispute ' \ - "##{dispute.id} for '#{dispute.domain_name}'" - @backlog[:activated] += 1 + def create_backlog_entry(dispute:, intent:, successful:) + if successful + @backlog["#{intent}d"] << dispute.id + Rails.logger.info "DisputeStatusUpdateJob - #{intent}d dispute " \ + " for '#{dispute.domain_name}'" else - Rails.logger.info 'DisputeStatusCloseJob - Failed to activate dispute ' \ - "##{dispute.id} for '#{dispute.domain_name}'" - @backlog[:active_fail] << dispute.id + @backlog["#{intent}_fail"] << dispute.id + Rails.logger.info 'DisputeStatusUpdateJob - Failed to' \ + "#{intent} dispute for '#{dispute.domain_name}'" end end @@ -58,9 +52,9 @@ class DisputeStatusUpdateJob < Que::Job "#{@backlog[:close_fail]}") end - return unless @backlog[:active_fail].any? + return unless @backlog[:activate_fail].any? Rails.logger.info('DisputeStatuseCloseJob - Failed to activate disputes with Ids:' \ - "#{@backlog[:active_fail]}") + "#{@backlog[:activate_fail]}") end end From ffa529c97b3b0091510831ccb8838189c4561d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 30 Apr 2020 08:19:17 +0300 Subject: [PATCH 13/43] Sync password between reserved/disputed --- app/models/reserved_domain.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/reserved_domain.rb b/app/models/reserved_domain.rb index 11c9bb2f5..898b9efee 100644 --- a/app/models/reserved_domain.rb +++ b/app/models/reserved_domain.rb @@ -2,6 +2,7 @@ class ReservedDomain < ApplicationRecord include Versions # version/reserved_domain_version.rb before_save :fill_empty_passwords before_save :generate_data + before_save :sync_dispute_password after_destroy :remove_data validates :name, domain_name: true, uniqueness: true @@ -41,6 +42,11 @@ class ReservedDomain < ApplicationRecord self.password = SecureRandom.hex end + def sync_dispute_password + dispute = Dispute.active.find_by(domain_name: domain_name) + self.password = dispute.password if dispute.present? + end + def generate_data return if Domain.where(name: name).any? From 5fabfc7f24a8fa89f8adaf22719d7671ccfbc101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 30 Apr 2020 08:34:08 +0300 Subject: [PATCH 14/43] Improve domain zone validation for new Dispute --- app/models/dispute.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/dispute.rb b/app/models/dispute.rb index b9cabdeaa..c0579cd2c 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -108,7 +108,7 @@ class Dispute < ApplicationRecord def validate_domain_name_format return unless domain_name - zone = domain_name.split('.').last + zone = domain_name.reverse.rpartition('.').map(&:reverse).reverse.last supported_zone = DNS::Zone.origins.include?(zone) errors.add(:domain_name, :unsupported_zone) unless supported_zone From f73833e478197e1e77b49012912c0e8547dd220b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 30 Apr 2020 08:35:17 +0300 Subject: [PATCH 15/43] Ignore domain_name attribute on dispute update --- app/controllers/admin/disputes_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 82b48149b..8292bc464 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -35,7 +35,7 @@ module Admin # PATCH/PUT /admin/disputes/1 def update - if @dispute.update(dispute_params) + if @dispute.update(dispute_params.except(:domain_name)) redirect_to admin_disputes_url, notice: 'Dispute was successfully updated.' else render :edit From 483eec554e769527c027d27c52cfa57f18ab07db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 30 Apr 2020 08:59:27 +0300 Subject: [PATCH 16/43] Create tests for Dispute --- app/jobs/dispute_status_update_job.rb | 21 +++--- app/models/dispute.rb | 20 +++--- app/models/reserved_domain.rb | 2 +- test/fixtures/disputes.yml | 24 +++++++ test/integration/admin_area/disputes_test.rb | 60 ++++++++++++++++ test/jobs/dispute_status_update_job_test.rb | 70 +++++++++++++++++++ test/models/disputed_domain_test.rb | 52 ++++++++++++++ test/system/admin_area/bank_statement_test.rb | 2 +- 8 files changed, 228 insertions(+), 23 deletions(-) create mode 100644 test/fixtures/disputes.yml create mode 100644 test/integration/admin_area/disputes_test.rb create mode 100644 test/jobs/dispute_status_update_job_test.rb create mode 100644 test/models/disputed_domain_test.rb diff --git a/app/jobs/dispute_status_update_job.rb b/app/jobs/dispute_status_update_job.rb index c1cca5a78..736b65236 100644 --- a/app/jobs/dispute_status_update_job.rb +++ b/app/jobs/dispute_status_update_job.rb @@ -1,14 +1,15 @@ class DisputeStatusUpdateJob < Que::Job def run @backlog = { 'activated': 0, 'closed': 0, 'activate_fail': [], 'close_fail': [] } + .with_indifferent_access close_disputes activate_disputes - Rails.logger.info "DisputeStatusUpdateJob - All done. Closed #{@backlog[:closed]} and " \ - "activated #{@backlog[:closed]} disputes." + Rails.logger.info "DisputeStatusUpdateJob - All done. Closed #{@backlog['closed']} and " \ + "activated #{@backlog['activated']} disputes." - show_failed_disputes unless @backlog[:activate_fail].empty? && @backlog[:close_fail].empty? + show_failed_disputes unless @backlog['activate_fail'].empty? && @backlog['close_fail'].empty? end def close_disputes @@ -36,7 +37,7 @@ class DisputeStatusUpdateJob < Que::Job def create_backlog_entry(dispute:, intent:, successful:) if successful - @backlog["#{intent}d"] << dispute.id + @backlog["#{intent}d"] += 1 Rails.logger.info "DisputeStatusUpdateJob - #{intent}d dispute " \ " for '#{dispute.domain_name}'" else @@ -47,14 +48,14 @@ class DisputeStatusUpdateJob < Que::Job end def show_failed_disputes - if @backlog[:close_fail].any? - Rails.logger.info('DisputeStatuseCloseJob - Failed to close disputes with Ids:' \ - "#{@backlog[:close_fail]}") + if @backlog['close_fail'].any? + Rails.logger.info('DisputeStatusUpdateJob - Failed to close disputes with Ids:' \ + "#{@backlog['close_fail']}") end - return unless @backlog[:activate_fail].any? + return unless @backlog['activate_fail'].any? - Rails.logger.info('DisputeStatuseCloseJob - Failed to activate disputes with Ids:' \ - "#{@backlog[:activate_fail]}") + Rails.logger.info('DisputeStatusUpdateJob - Failed to activate disputes with Ids:' \ + "#{@backlog['activate_fail']}") end end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index c0579cd2c..19644c5f8 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -16,7 +16,7 @@ class Dispute < ApplicationRecord after_destroy :remove_data scope :expired, -> { where('expires_at < ?', Time.zone.today) } - scope :active, -> { where('expires_at > ? AND closed = false', Time.zone.today) } + scope :active, -> { where('expires_at >= ? AND closed = false', Time.zone.today) } scope :closed, -> { where(closed: true) } alias_attribute :name, :domain_name @@ -52,24 +52,21 @@ class Dispute < ApplicationRecord whois_record = Whois::Record.find_or_initialize_by(name: domain_name) return true if remove_whois_data(whois_record) - - false end def remove_whois_data(record) record.json['status'] = record.json['status'].delete_if { |status| status == 'disputed' } if record.json['status'].blank? - return true if record.destroy - - return false + return true if record.destroy && record.json['status'].blank? end record.save end def generate_json(record) - status_arr = (record.json['status'] ||= []) h = HashWithIndifferentAccess.new(name: domain_name, status: ['disputed']) return h if record.json.blank? + + status_arr = (record.json['status'] ||= []) return record.json if status_arr.include? 'disputed' status_arr.push('disputed') @@ -115,12 +112,13 @@ class Dispute < ApplicationRecord end def validate_domain_name_period_uniqueness - return unless new_record? - existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: false) - .where('expires_at > ?', starts_at) + .where('expires_at >= ?', starts_at) + + existing_dispute = existing_dispute.where.not(id: id) unless new_record? + return unless existing_dispute.any? - errors.add(:base, 'Dispute already exists for this domain at given timeframe') + errors.add(:starts_at, 'Dispute already exists for this domain at given timeframe') end end diff --git a/app/models/reserved_domain.rb b/app/models/reserved_domain.rb index 898b9efee..9ee85548b 100644 --- a/app/models/reserved_domain.rb +++ b/app/models/reserved_domain.rb @@ -43,7 +43,7 @@ class ReservedDomain < ApplicationRecord end def sync_dispute_password - dispute = Dispute.active.find_by(domain_name: domain_name) + dispute = Dispute.active.find_by(domain_name: name) self.password = dispute.password if dispute.present? end diff --git a/test/fixtures/disputes.yml b/test/fixtures/disputes.yml new file mode 100644 index 000000000..3e6b882f4 --- /dev/null +++ b/test/fixtures/disputes.yml @@ -0,0 +1,24 @@ +active: + domain_name: active-dispute.test + password: active-001 + starts_at: <%= Date.parse '2010-07-05' %> + expires_at: <%= Date.parse '2013-07-05' %> + closed: false +future: + domain_name: future-dispute.test + password: active-001 + starts_at: <%= Date.parse '2010-10-05' %> + expires_at: <%= Date.parse '2013-10-05' %> + closed: false +expired: + domain_name: expired-dispute.test + password: active-001 + starts_at: <%= Date.parse '2010-07-05' %> + expires_at: <%= Date.parse '2013-07-05' %> + closed: true +closed: + domain_name: closed_dispute.test + password: active-001 + starts_at: <%= Date.parse '2010-07-05' %> + expires_at: <%= Date.parse '2013-07-05' %> + closed: true diff --git a/test/integration/admin_area/disputes_test.rb b/test/integration/admin_area/disputes_test.rb new file mode 100644 index 000000000..fcd06f759 --- /dev/null +++ b/test/integration/admin_area/disputes_test.rb @@ -0,0 +1,60 @@ +require 'application_system_test_case' +require 'test_helper' + +class AdminDisputesSystemTest < ApplicationSystemTestCase + include ActionView::Helpers::NumberHelper + + setup do + @dispute = disputes(:active) + @original_default_language = Setting.default_language + sign_in users(:admin) + end + + teardown do + Setting.default_language = @original_default_language + end + + def test_creates_new_dispute + assert_nil Dispute.active.find_by(domain_name: 'disputed.test') + + visit admin_disputes_path + click_on 'New domain dispute' + + fill_in 'Domain name', with: 'disputed.test' + fill_in 'Password', with: '1234' + fill_in 'Starts at', with: Time.zone.today.to_s + fill_in 'Comment', with: 'Sample comment' + click_on 'Save' + + assert_text 'Dispute was successfully created.' + assert_text 'disputed.test' + end + + def test_updates_dispute + assert_not_equal Time.zone.today, @dispute.starts_at + + visit edit_admin_dispute_path(@dispute) + fill_in 'Starts at', with: Time.zone.today.to_s + click_link_or_button 'Save' + + assert_text 'Dispute was successfully updated' + assert_text Time.zone.today + end + + def test_deletes_dispute + visit delete_admin_dispute_path(@dispute) + + assert_text 'Dispute was successfully destroyed.' + end + + def test_can_not_create_overlapping_dispute + visit admin_disputes_path + click_on 'New domain dispute' + + fill_in 'Domain name', with: 'active-dispute.test' + fill_in 'Starts at', with: @dispute.starts_at + 1.day + click_on 'Save' + + assert_text 'Dispute already exists for this domain at given timeframe' + end +end diff --git a/test/jobs/dispute_status_update_job_test.rb b/test/jobs/dispute_status_update_job_test.rb new file mode 100644 index 000000000..a91dc63d5 --- /dev/null +++ b/test/jobs/dispute_status_update_job_test.rb @@ -0,0 +1,70 @@ +require "test_helper" + +class DisputeStatusUpdateJobTest < ActiveSupport::TestCase + setup do + travel_to Time.zone.parse('2010-10-05') + end + + def test_nothing_is_raised + assert_nothing_raised do + DisputeStatusUpdateJob.run + end + end + + def test_whois_data_added_when_dispute_activated + dispute = disputes(:future) + DisputeStatusUpdateJob.run + + whois_record = Whois::Record.find_by(name: dispute.domain_name) + assert whois_record.present? + assert_includes whois_record.json['status'], 'disputed' + end + + def test_unregistered_domain_whois_data_is_deleted + dispute = disputes(:active) + dispute.update!(starts_at: Time.zone.today - 3.years - 1.day) + + DisputeStatusUpdateJob.run + dispute.reload + + assert dispute.closed + + whois_record = Whois::Record.find_by(name: dispute.domain_name) + assert whois_record.nil? + end + + def test_registered_domain_whois_data_is_added + Dispute.create(domain_name: 'shop.test', starts_at: '2010-07-05') + travel_to Time.zone.parse('2010-07-05') + DisputeStatusUpdateJob.run + + whois_record = Whois::Record.find_by(name: 'shop.test') + assert_includes whois_record.json['status'], 'disputed' + end + + def test_registered_domain_whois_data_is_removed + travel_to Time.zone.parse('2010-07-05') + + domain = domains(:shop) + domain.update(valid_to: Time.zone.parse('2015-07-05').to_s(:db), + outzone_at: Time.zone.parse('2015-07-06').to_s(:db), + delete_date: nil, + force_delete_date: nil) + + # Dispute status is added automatically if starts_at is not in future + Dispute.create(domain_name: 'shop.test', starts_at: Time.zone.parse('2010-07-05')) + domain.reload + + whois_record = Whois::Record.find_by(name: 'shop.test') + assert_includes whois_record.json['status'], 'disputed' + + # Dispute status is removed night time day after it's ended + travel_to Time.zone.parse('2010-07-05') + 3.years + 1.day + + DisputeStatusUpdateJob.run + + whois_record.reload + assert_not whois_record.json['status'].include? 'disputed' + puts whois_record.json['status'] + end +end diff --git a/test/models/disputed_domain_test.rb b/test/models/disputed_domain_test.rb new file mode 100644 index 000000000..01897e19b --- /dev/null +++ b/test/models/disputed_domain_test.rb @@ -0,0 +1,52 @@ +require 'test_helper' + +class DisputedDomainTest < ActiveSupport::TestCase + setup do + @dispute = disputes(:active) + end + + def test_fixture_is_valid + assert @dispute.valid? + end + + def test_can_be_closed_by_domain_name + travel_to Time.zone.parse('2010-10-05') + + Dispute.close_by_domain(@dispute.domain_name) + @dispute.reload + + assert @dispute.closed + end + + def test_syncs_password_to_reserved + dispute = Dispute.new(domain_name: 'reserved.test', starts_at: Time.zone.today, password: 'disputepw') + dispute.save + dispute.reload + assert_equal dispute.password, ReservedDomain.find_by(name: dispute.domain_name).password + end + + def test_domain_name_zone_is_validated + dispute = Dispute.new(domain_name: 'correct.test', starts_at: Time.zone.today) + assert dispute.valid? + + dispute.domain_name = 'zone.is.unrecognized.test' + assert_not dispute.valid? + end + + def test_dispute_can_not_be_created_if_another_active_is_present + dispute = Dispute.new(domain_name: @dispute.domain_name, + starts_at: @dispute.starts_at + 1.day) + assert_not dispute.valid? + end + + def test_expires_at_date_is_appended_automatically + dispute = Dispute.new(domain_name: 'random.test', starts_at: Time.zone.today) + assert dispute.valid? + assert_equal dispute.expires_at, dispute.starts_at + 3.years + end + + def test_starts_at_must_be_present + dispute = Dispute.new(domain_name: 'random.test') + assert_not dispute.valid? + end +end diff --git a/test/system/admin_area/bank_statement_test.rb b/test/system/admin_area/bank_statement_test.rb index c95035a8d..29ed4f312 100644 --- a/test/system/admin_area/bank_statement_test.rb +++ b/test/system/admin_area/bank_statement_test.rb @@ -1,6 +1,6 @@ require 'application_system_test_case' -class BankStatementTest < ApplicationSystemTestCase +class AdminBankStatementsSystemTest < ApplicationSystemTestCase setup do sign_in users(:admin) travel_to Time.zone.parse('2010-07-05 00:30:00') From 928f96691cc8d8e270af06c2f1fd8628f55286f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 4 May 2020 08:14:56 +0300 Subject: [PATCH 17/43] Make dispute domain_name read only --- app/models/dispute.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 19644c5f8..a83157ecd 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - class Dispute < ApplicationRecord validates :domain_name, :password, :starts_at, :expires_at, presence: true before_validation :fill_empty_passwords @@ -10,6 +8,7 @@ class Dispute < ApplicationRecord with_options on: :admin do validate :validate_start_date end + before_save :set_expiry_date before_save :sync_reserved_password before_save :generate_data @@ -19,6 +18,8 @@ class Dispute < ApplicationRecord scope :active, -> { where('expires_at >= ? AND closed = false', Time.zone.today) } scope :closed, -> { where(closed: true) } + attr_readonly :domain_name + alias_attribute :name, :domain_name def self.close_by_domain(domain_name) @@ -97,6 +98,7 @@ class Dispute < ApplicationRecord private def validate_start_date + puts 'EXECUTED' return if starts_at.nil? errors.add(:starts_at, :past) if starts_at.past? From 1dc2cf8e128923605d7ce1c950405f17f2b20f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 4 May 2020 09:06:33 +0300 Subject: [PATCH 18/43] Check for domain dispute on create --- app/controllers/epp/domains_controller.rb | 2 +- app/models/dispute.rb | 5 ++++- app/models/domain.rb | 21 +++++++++++++++++++- test/integration/admin_area/disputes_test.rb | 16 +++++++++++++++ test/jobs/dispute_status_update_job_test.rb | 1 - 5 files changed, 41 insertions(+), 4 deletions(-) diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 9a162a455..4e91632e5 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -92,7 +92,7 @@ module Epp status: Auction.statuses[:payment_received]) active_auction.domain_registered! end - + Dispute.close_by_domain(@domain.name) render_epp_response '/epp/domains/create' else handle_errors(@domain) diff --git a/app/models/dispute.rb b/app/models/dispute.rb index a83157ecd..b80a33e9c 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -27,6 +27,10 @@ class Dispute < ApplicationRecord dispute.update(closed: true) if dispute.present? end + def self.valid_auth?(domain_name, password) + Dispute.active.find_by(domain_name: domain_name, password: password).present? + end + def set_expiry_date return if starts_at.blank? @@ -98,7 +102,6 @@ class Dispute < ApplicationRecord private def validate_start_date - puts 'EXECUTED' return if starts_at.nil? errors.add(:starts_at, :past) if starts_at.past? diff --git a/app/models/domain.rb b/app/models/domain.rb index 229e806fb..82921e3ab 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -90,7 +90,7 @@ class Domain < ApplicationRecord validates :transfer_code, presence: true validate :validate_reservation - + validate :validate_disputed def validate_reservation return if persisted? || !in_reserved_list? @@ -104,6 +104,19 @@ class Domain < ApplicationRecord errors.add(:base, :invalid_auth_information_reserved) end + def validate_disputed + return if persisted? || !in_disputed_list? + + if reserved_pw.blank? + errors.add(:base, :required_parameter_missing_reserved) + return false + end + + return if Dispute.valid_auth?(name, reserved_pw) + + errors.add(:base, :invalid_auth_information_reserved) + end + validate :status_is_consistant def status_is_consistant has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE)) @@ -277,6 +290,10 @@ class Domain < ApplicationRecord @in_reserved_list ||= ReservedDomain.by_domain(name).any? end + def in_disputed_list? + @in_disputed_list ||= Dispute.active.find_by(domain_name: name).present? + end + def disputed? Dispute.active.where(domain_name: name).any? end @@ -302,6 +319,8 @@ class Domain < ApplicationRecord return false if statuses.include_any?(DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW, DomainStatus::PENDING_TRANSFER, DomainStatus::PENDING_DELETE, DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION) + return false if disputed? + true end diff --git a/test/integration/admin_area/disputes_test.rb b/test/integration/admin_area/disputes_test.rb index fcd06f759..1806eaea4 100644 --- a/test/integration/admin_area/disputes_test.rb +++ b/test/integration/admin_area/disputes_test.rb @@ -30,6 +30,22 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase assert_text 'disputed.test' end + def test_throws_error_if_starts_at_is_past + assert_nil Dispute.active.find_by(domain_name: 'disputed.test') + + visit admin_disputes_path + click_on 'New domain dispute' + + fill_in 'Domain name', with: 'disputed.test' + fill_in 'Password', with: '1234' + fill_in 'Starts at', with: (Time.zone.today - 2.day).to_s + fill_in 'Comment', with: 'Sample comment' + click_on 'Save' + + assert_text 'Dispute was successfully created.' + assert_text 'disputed.test' + end + def test_updates_dispute assert_not_equal Time.zone.today, @dispute.starts_at diff --git a/test/jobs/dispute_status_update_job_test.rb b/test/jobs/dispute_status_update_job_test.rb index a91dc63d5..a66db3459 100644 --- a/test/jobs/dispute_status_update_job_test.rb +++ b/test/jobs/dispute_status_update_job_test.rb @@ -65,6 +65,5 @@ class DisputeStatusUpdateJobTest < ActiveSupport::TestCase whois_record.reload assert_not whois_record.json['status'].include? 'disputed' - puts whois_record.json['status'] end end From a270fc84226d594acc2fa7e67930162e8ddc3254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 4 May 2020 11:11:58 +0300 Subject: [PATCH 19/43] Fix identation for Dispute form --- app/views/admin/disputes/_form.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/disputes/_form.html.erb b/app/views/admin/disputes/_form.html.erb index 38d5fbda2..df2151c6c 100644 --- a/app/views/admin/disputes/_form.html.erb +++ b/app/views/admin/disputes/_form.html.erb @@ -10,9 +10,9 @@
-
-

As per domain law, expiry time is <%= Setting.dispute_period_in_months / 12 %> years ahead from start date.

-
+
+

As per domain law, expiry time is <%= Setting.dispute_period_in_months / 12 %> years ahead from start date.

+
<%= f.label :domain_name %> From 408c7c5c6c8585c4f821c2167f49efe40c165144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 4 May 2020 11:58:46 +0300 Subject: [PATCH 20/43] Remove whitespaces from structure.sql --- db/structure.sql | 697 ++++++++++++++++++++--------------------------- 1 file changed, 302 insertions(+), 395 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index 6b690e04e..a810d977c 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1,3 +1,7 @@ +-- +-- PostgreSQL database dump +-- + SET statement_timeout = 0; SET lock_timeout = 0; SET client_encoding = 'UTF8'; @@ -8,10 +12,17 @@ SET xmloption = content; SET client_min_messages = warning; -- --- Name: audit; Type: SCHEMA; Schema: -; Owner: - +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - -- -CREATE SCHEMA audit; +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; -- @@ -180,75 +191,12 @@ CREATE FUNCTION public.generate_zonefile(i_origin character varying) RETURNS tex $_$; --- --- Name: process_contact_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_contact_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.contacts - (object_id, action, recorded_at, old_value, new_value) - VALUES (NEW.id, 'INSERT', now(), '{}', to_json(NEW)::jsonb); - RETURN NEW; - ELSEIF (TG_OP = 'UPDATE') THEN - INSERT INTO audit.contacts - (object_id, action, recorded_at, old_value, new_value) - VALUES (NEW.id, 'UPDATE', now(), to_json(OLD)::jsonb, to_json(NEW)::jsonb); - RETURN NEW; - ELSEIF (TG_OP = 'DELETE') THEN - INSERT INTO audit.contacts - (object_id, action, recorded_at, old_value, new_value) - VALUES (OLD.id, 'DELETE', now(), to_json(OLD)::jsonb, '{}'); - RETURN OLD; - END IF; - RETURN NULL; - END -$$; - - SET default_tablespace = ''; SET default_with_oids = false; -- --- Name: contacts; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.contacts ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT contacts_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: contacts_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.contacts_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.contacts_id_seq OWNED BY audit.contacts.id; - - --- --- Name: account_activities; Type: TABLE; Schema: public; Owner: - +-- Name: account_activities; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.account_activities ( @@ -288,7 +236,7 @@ ALTER SEQUENCE public.account_activities_id_seq OWNED BY public.account_activiti -- --- Name: accounts; Type: TABLE; Schema: public; Owner: - +-- Name: accounts; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.accounts ( @@ -324,7 +272,7 @@ ALTER SEQUENCE public.accounts_id_seq OWNED BY public.accounts.id; -- --- Name: actions; Type: TABLE; Schema: public; Owner: - +-- Name: actions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.actions ( @@ -356,7 +304,7 @@ ALTER SEQUENCE public.actions_id_seq OWNED BY public.actions.id; -- --- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - +-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.ar_internal_metadata ( @@ -368,7 +316,7 @@ CREATE TABLE public.ar_internal_metadata ( -- --- Name: auctions; Type: TABLE; Schema: public; Owner: - +-- Name: auctions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.auctions ( @@ -401,7 +349,7 @@ ALTER SEQUENCE public.auctions_id_seq OWNED BY public.auctions.id; -- --- Name: bank_statements; Type: TABLE; Schema: public; Owner: - +-- Name: bank_statements; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.bank_statements ( @@ -437,7 +385,7 @@ ALTER SEQUENCE public.bank_statements_id_seq OWNED BY public.bank_statements.id; -- --- Name: bank_transactions; Type: TABLE; Schema: public; Owner: - +-- Name: bank_transactions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.bank_transactions ( @@ -481,7 +429,7 @@ ALTER SEQUENCE public.bank_transactions_id_seq OWNED BY public.bank_transactions -- --- Name: blocked_domains; Type: TABLE; Schema: public; Owner: - +-- Name: blocked_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.blocked_domains ( @@ -514,7 +462,7 @@ ALTER SEQUENCE public.blocked_domains_id_seq OWNED BY public.blocked_domains.id; -- --- Name: certificates; Type: TABLE; Schema: public; Owner: - +-- Name: certificates; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.certificates ( @@ -552,7 +500,7 @@ ALTER SEQUENCE public.certificates_id_seq OWNED BY public.certificates.id; -- --- Name: contacts; Type: TABLE; Schema: public; Owner: - +-- Name: contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.contacts ( @@ -610,7 +558,7 @@ ALTER SEQUENCE public.contacts_id_seq OWNED BY public.contacts.id; -- --- Name: directos; Type: TABLE; Schema: public; Owner: - +-- Name: directos; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.directos ( @@ -645,7 +593,7 @@ ALTER SEQUENCE public.directos_id_seq OWNED BY public.directos.id; -- --- Name: disputes; Type: TABLE; Schema: public; Owner: - +-- Name: disputes; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.disputes ( @@ -681,7 +629,7 @@ ALTER SEQUENCE public.disputes_id_seq OWNED BY public.disputes.id; -- --- Name: dnskeys; Type: TABLE; Schema: public; Owner: - +-- Name: dnskeys; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.dnskeys ( @@ -722,7 +670,7 @@ ALTER SEQUENCE public.dnskeys_id_seq OWNED BY public.dnskeys.id; -- --- Name: domain_contacts; Type: TABLE; Schema: public; Owner: - +-- Name: domain_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.domain_contacts ( @@ -760,7 +708,7 @@ ALTER SEQUENCE public.domain_contacts_id_seq OWNED BY public.domain_contacts.id; -- --- Name: domain_transfers; Type: TABLE; Schema: public; Owner: - +-- Name: domain_transfers; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.domain_transfers ( @@ -797,7 +745,7 @@ ALTER SEQUENCE public.domain_transfers_id_seq OWNED BY public.domain_transfers.i -- --- Name: domains; Type: TABLE; Schema: public; Owner: - +-- Name: domains; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.domains ( @@ -857,7 +805,7 @@ ALTER SEQUENCE public.domains_id_seq OWNED BY public.domains.id; -- --- Name: epp_sessions; Type: TABLE; Schema: public; Owner: - +-- Name: epp_sessions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.epp_sessions ( @@ -889,7 +837,7 @@ ALTER SEQUENCE public.epp_sessions_id_seq OWNED BY public.epp_sessions.id; -- --- Name: invoice_items; Type: TABLE; Schema: public; Owner: - +-- Name: invoice_items; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.invoice_items ( @@ -927,7 +875,7 @@ ALTER SEQUENCE public.invoice_items_id_seq OWNED BY public.invoice_items.id; -- --- Name: invoices; Type: TABLE; Schema: public; Owner: - +-- Name: invoices; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.invoices ( @@ -998,7 +946,7 @@ ALTER SEQUENCE public.invoices_id_seq OWNED BY public.invoices.id; -- --- Name: legal_documents; Type: TABLE; Schema: public; Owner: - +-- Name: legal_documents; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.legal_documents ( @@ -1033,7 +981,7 @@ ALTER SEQUENCE public.legal_documents_id_seq OWNED BY public.legal_documents.id; -- --- Name: log_account_activities; Type: TABLE; Schema: public; Owner: - +-- Name: log_account_activities; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_account_activities ( @@ -1071,7 +1019,7 @@ ALTER SEQUENCE public.log_account_activities_id_seq OWNED BY public.log_account_ -- --- Name: log_accounts; Type: TABLE; Schema: public; Owner: - +-- Name: log_accounts; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_accounts ( @@ -1109,7 +1057,7 @@ ALTER SEQUENCE public.log_accounts_id_seq OWNED BY public.log_accounts.id; -- --- Name: log_actions; Type: TABLE; Schema: public; Owner: - +-- Name: log_actions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_actions ( @@ -1147,7 +1095,7 @@ ALTER SEQUENCE public.log_actions_id_seq OWNED BY public.log_actions.id; -- --- Name: log_bank_statements; Type: TABLE; Schema: public; Owner: - +-- Name: log_bank_statements; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_bank_statements ( @@ -1185,7 +1133,7 @@ ALTER SEQUENCE public.log_bank_statements_id_seq OWNED BY public.log_bank_statem -- --- Name: log_bank_transactions; Type: TABLE; Schema: public; Owner: - +-- Name: log_bank_transactions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_bank_transactions ( @@ -1223,7 +1171,7 @@ ALTER SEQUENCE public.log_bank_transactions_id_seq OWNED BY public.log_bank_tran -- --- Name: log_blocked_domains; Type: TABLE; Schema: public; Owner: - +-- Name: log_blocked_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_blocked_domains ( @@ -1261,7 +1209,7 @@ ALTER SEQUENCE public.log_blocked_domains_id_seq OWNED BY public.log_blocked_dom -- --- Name: log_certificates; Type: TABLE; Schema: public; Owner: - +-- Name: log_certificates; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_certificates ( @@ -1299,7 +1247,7 @@ ALTER SEQUENCE public.log_certificates_id_seq OWNED BY public.log_certificates.i -- --- Name: log_contacts; Type: TABLE; Schema: public; Owner: - +-- Name: log_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_contacts ( @@ -1338,7 +1286,7 @@ ALTER SEQUENCE public.log_contacts_id_seq OWNED BY public.log_contacts.id; -- --- Name: log_dnskeys; Type: TABLE; Schema: public; Owner: - +-- Name: log_dnskeys; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_dnskeys ( @@ -1376,7 +1324,7 @@ ALTER SEQUENCE public.log_dnskeys_id_seq OWNED BY public.log_dnskeys.id; -- --- Name: log_domain_contacts; Type: TABLE; Schema: public; Owner: - +-- Name: log_domain_contacts; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_domain_contacts ( @@ -1414,7 +1362,7 @@ ALTER SEQUENCE public.log_domain_contacts_id_seq OWNED BY public.log_domain_cont -- --- Name: log_domains; Type: TABLE; Schema: public; Owner: - +-- Name: log_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_domains ( @@ -1452,7 +1400,7 @@ ALTER SEQUENCE public.log_domains_id_seq OWNED BY public.log_domains.id; -- --- Name: log_invoice_items; Type: TABLE; Schema: public; Owner: - +-- Name: log_invoice_items; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_invoice_items ( @@ -1490,7 +1438,7 @@ ALTER SEQUENCE public.log_invoice_items_id_seq OWNED BY public.log_invoice_items -- --- Name: log_invoices; Type: TABLE; Schema: public; Owner: - +-- Name: log_invoices; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_invoices ( @@ -1528,7 +1476,7 @@ ALTER SEQUENCE public.log_invoices_id_seq OWNED BY public.log_invoices.id; -- --- Name: log_nameservers; Type: TABLE; Schema: public; Owner: - +-- Name: log_nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_nameservers ( @@ -1566,7 +1514,7 @@ ALTER SEQUENCE public.log_nameservers_id_seq OWNED BY public.log_nameservers.id; -- --- Name: log_notifications; Type: TABLE; Schema: public; Owner: - +-- Name: log_notifications; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_notifications ( @@ -1604,7 +1552,7 @@ ALTER SEQUENCE public.log_notifications_id_seq OWNED BY public.log_notifications -- --- Name: log_payment_orders; Type: TABLE; Schema: public; Owner: - +-- Name: log_payment_orders; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_payment_orders ( @@ -1642,7 +1590,7 @@ ALTER SEQUENCE public.log_payment_orders_id_seq OWNED BY public.log_payment_orde -- --- Name: log_registrant_verifications; Type: TABLE; Schema: public; Owner: - +-- Name: log_registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_registrant_verifications ( @@ -1679,7 +1627,7 @@ ALTER SEQUENCE public.log_registrant_verifications_id_seq OWNED BY public.log_re -- --- Name: log_registrars; Type: TABLE; Schema: public; Owner: - +-- Name: log_registrars; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_registrars ( @@ -1717,7 +1665,7 @@ ALTER SEQUENCE public.log_registrars_id_seq OWNED BY public.log_registrars.id; -- --- Name: log_reserved_domains; Type: TABLE; Schema: public; Owner: - +-- Name: log_reserved_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_reserved_domains ( @@ -1755,7 +1703,7 @@ ALTER SEQUENCE public.log_reserved_domains_id_seq OWNED BY public.log_reserved_d -- --- Name: log_settings; Type: TABLE; Schema: public; Owner: - +-- Name: log_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_settings ( @@ -1793,7 +1741,7 @@ ALTER SEQUENCE public.log_settings_id_seq OWNED BY public.log_settings.id; -- --- Name: log_users; Type: TABLE; Schema: public; Owner: - +-- Name: log_users; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_users ( @@ -1831,7 +1779,7 @@ ALTER SEQUENCE public.log_users_id_seq OWNED BY public.log_users.id; -- --- Name: log_white_ips; Type: TABLE; Schema: public; Owner: - +-- Name: log_white_ips; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_white_ips ( @@ -1869,7 +1817,7 @@ ALTER SEQUENCE public.log_white_ips_id_seq OWNED BY public.log_white_ips.id; -- --- Name: nameservers; Type: TABLE; Schema: public; Owner: - +-- Name: nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.nameservers ( @@ -1907,7 +1855,7 @@ ALTER SEQUENCE public.nameservers_id_seq OWNED BY public.nameservers.id; -- --- Name: notifications; Type: TABLE; Schema: public; Owner: - +-- Name: notifications; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.notifications ( @@ -1945,7 +1893,7 @@ ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id; -- --- Name: payment_orders; Type: TABLE; Schema: public; Owner: - +-- Name: payment_orders; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.payment_orders ( @@ -1982,7 +1930,7 @@ ALTER SEQUENCE public.payment_orders_id_seq OWNED BY public.payment_orders.id; -- --- Name: prices; Type: TABLE; Schema: public; Owner: - +-- Name: prices; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.prices ( @@ -2020,7 +1968,7 @@ ALTER SEQUENCE public.prices_id_seq OWNED BY public.prices.id; -- --- Name: que_jobs; Type: TABLE; Schema: public; Owner: - +-- Name: que_jobs; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.que_jobs ( @@ -2062,7 +2010,7 @@ ALTER SEQUENCE public.que_jobs_job_id_seq OWNED BY public.que_jobs.job_id; -- --- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: - +-- Name: registrant_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.registrant_verifications ( @@ -2098,7 +2046,7 @@ ALTER SEQUENCE public.registrant_verifications_id_seq OWNED BY public.registrant -- --- Name: registrars; Type: TABLE; Schema: public; Owner: - +-- Name: registrars; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.registrars ( @@ -2151,7 +2099,7 @@ ALTER SEQUENCE public.registrars_id_seq OWNED BY public.registrars.id; -- --- Name: reserved_domains; Type: TABLE; Schema: public; Owner: - +-- Name: reserved_domains; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.reserved_domains ( @@ -2186,7 +2134,7 @@ ALTER SEQUENCE public.reserved_domains_id_seq OWNED BY public.reserved_domains.i -- --- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.schema_migrations ( @@ -2195,7 +2143,7 @@ CREATE TABLE public.schema_migrations ( -- --- Name: settings; Type: TABLE; Schema: public; Owner: - +-- Name: settings; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.settings ( @@ -2231,7 +2179,7 @@ ALTER SEQUENCE public.settings_id_seq OWNED BY public.settings.id; -- --- Name: users; Type: TABLE; Schema: public; Owner: - +-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.users ( @@ -2283,7 +2231,7 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; -- --- Name: versions; Type: TABLE; Schema: public; Owner: - +-- Name: versions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.versions ( @@ -2318,7 +2266,7 @@ ALTER SEQUENCE public.versions_id_seq OWNED BY public.versions.id; -- --- Name: white_ips; Type: TABLE; Schema: public; Owner: - +-- Name: white_ips; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.white_ips ( @@ -2354,7 +2302,7 @@ ALTER SEQUENCE public.white_ips_id_seq OWNED BY public.white_ips.id; -- --- Name: whois_records; Type: TABLE; Schema: public; Owner: - +-- Name: whois_records; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.whois_records ( @@ -2389,7 +2337,7 @@ ALTER SEQUENCE public.whois_records_id_seq OWNED BY public.whois_records.id; -- --- Name: zones; Type: TABLE; Schema: public; Owner: - +-- Name: zones; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.zones ( @@ -2432,407 +2380,392 @@ ALTER SEQUENCE public.zones_id_seq OWNED BY public.zones.id; -- --- Name: contacts id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.contacts ALTER COLUMN id SET DEFAULT nextval('audit.contacts_id_seq'::regclass); - - --- --- Name: account_activities id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities ALTER COLUMN id SET DEFAULT nextval('public.account_activities_id_seq'::regclass); -- --- Name: accounts id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.accounts ALTER COLUMN id SET DEFAULT nextval('public.accounts_id_seq'::regclass); -- --- Name: actions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.actions ALTER COLUMN id SET DEFAULT nextval('public.actions_id_seq'::regclass); -- --- Name: auctions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.auctions ALTER COLUMN id SET DEFAULT nextval('public.auctions_id_seq'::regclass); -- --- Name: bank_statements id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.bank_statements ALTER COLUMN id SET DEFAULT nextval('public.bank_statements_id_seq'::regclass); -- --- Name: bank_transactions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.bank_transactions ALTER COLUMN id SET DEFAULT nextval('public.bank_transactions_id_seq'::regclass); -- --- Name: blocked_domains id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.blocked_domains ALTER COLUMN id SET DEFAULT nextval('public.blocked_domains_id_seq'::regclass); -- --- Name: certificates id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.certificates ALTER COLUMN id SET DEFAULT nextval('public.certificates_id_seq'::regclass); -- --- Name: contacts id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts ALTER COLUMN id SET DEFAULT nextval('public.contacts_id_seq'::regclass); -- --- Name: directos id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.directos ALTER COLUMN id SET DEFAULT nextval('public.directos_id_seq'::regclass); -- --- Name: disputes id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.disputes ALTER COLUMN id SET DEFAULT nextval('public.disputes_id_seq'::regclass); -- --- Name: dnskeys id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.dnskeys ALTER COLUMN id SET DEFAULT nextval('public.dnskeys_id_seq'::regclass); -- --- Name: domain_contacts id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_contacts ALTER COLUMN id SET DEFAULT nextval('public.domain_contacts_id_seq'::regclass); -- --- Name: domain_transfers id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers ALTER COLUMN id SET DEFAULT nextval('public.domain_transfers_id_seq'::regclass); -- --- Name: domains id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domains ALTER COLUMN id SET DEFAULT nextval('public.domains_id_seq'::regclass); -- --- Name: epp_sessions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.epp_sessions ALTER COLUMN id SET DEFAULT nextval('public.epp_sessions_id_seq'::regclass); -- --- Name: invoice_items id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoice_items ALTER COLUMN id SET DEFAULT nextval('public.invoice_items_id_seq'::regclass); -- --- Name: invoices id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoices ALTER COLUMN id SET DEFAULT nextval('public.invoices_id_seq'::regclass); -- --- Name: legal_documents id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.legal_documents ALTER COLUMN id SET DEFAULT nextval('public.legal_documents_id_seq'::regclass); -- --- Name: log_account_activities id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_account_activities ALTER COLUMN id SET DEFAULT nextval('public.log_account_activities_id_seq'::regclass); -- --- Name: log_accounts id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_accounts ALTER COLUMN id SET DEFAULT nextval('public.log_accounts_id_seq'::regclass); -- --- Name: log_actions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_actions ALTER COLUMN id SET DEFAULT nextval('public.log_actions_id_seq'::regclass); -- --- Name: log_bank_statements id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_bank_statements ALTER COLUMN id SET DEFAULT nextval('public.log_bank_statements_id_seq'::regclass); -- --- Name: log_bank_transactions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_bank_transactions ALTER COLUMN id SET DEFAULT nextval('public.log_bank_transactions_id_seq'::regclass); -- --- Name: log_blocked_domains id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_blocked_domains ALTER COLUMN id SET DEFAULT nextval('public.log_blocked_domains_id_seq'::regclass); -- --- Name: log_certificates id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_certificates ALTER COLUMN id SET DEFAULT nextval('public.log_certificates_id_seq'::regclass); -- --- Name: log_contacts id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_contacts ALTER COLUMN id SET DEFAULT nextval('public.log_contacts_id_seq'::regclass); -- --- Name: log_dnskeys id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_dnskeys ALTER COLUMN id SET DEFAULT nextval('public.log_dnskeys_id_seq'::regclass); -- --- Name: log_domain_contacts id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_domain_contacts ALTER COLUMN id SET DEFAULT nextval('public.log_domain_contacts_id_seq'::regclass); -- --- Name: log_domains id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_domains ALTER COLUMN id SET DEFAULT nextval('public.log_domains_id_seq'::regclass); -- --- Name: log_invoice_items id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_invoice_items ALTER COLUMN id SET DEFAULT nextval('public.log_invoice_items_id_seq'::regclass); -- --- Name: log_invoices id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_invoices ALTER COLUMN id SET DEFAULT nextval('public.log_invoices_id_seq'::regclass); -- --- Name: log_nameservers id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_nameservers ALTER COLUMN id SET DEFAULT nextval('public.log_nameservers_id_seq'::regclass); -- --- Name: log_notifications id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_notifications ALTER COLUMN id SET DEFAULT nextval('public.log_notifications_id_seq'::regclass); -- --- Name: log_payment_orders id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_payment_orders ALTER COLUMN id SET DEFAULT nextval('public.log_payment_orders_id_seq'::regclass); -- --- Name: log_registrant_verifications id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_registrant_verifications ALTER COLUMN id SET DEFAULT nextval('public.log_registrant_verifications_id_seq'::regclass); -- --- Name: log_registrars id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_registrars ALTER COLUMN id SET DEFAULT nextval('public.log_registrars_id_seq'::regclass); -- --- Name: log_reserved_domains id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_reserved_domains ALTER COLUMN id SET DEFAULT nextval('public.log_reserved_domains_id_seq'::regclass); -- --- Name: log_settings id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_settings ALTER COLUMN id SET DEFAULT nextval('public.log_settings_id_seq'::regclass); -- --- Name: log_users id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_users ALTER COLUMN id SET DEFAULT nextval('public.log_users_id_seq'::regclass); -- --- Name: log_white_ips id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_white_ips ALTER COLUMN id SET DEFAULT nextval('public.log_white_ips_id_seq'::regclass); -- --- Name: nameservers id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.nameservers ALTER COLUMN id SET DEFAULT nextval('public.nameservers_id_seq'::regclass); -- --- Name: notifications id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass); -- --- Name: payment_orders id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.payment_orders ALTER COLUMN id SET DEFAULT nextval('public.payment_orders_id_seq'::regclass); -- --- Name: prices id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.prices ALTER COLUMN id SET DEFAULT nextval('public.prices_id_seq'::regclass); -- --- Name: que_jobs job_id; Type: DEFAULT; Schema: public; Owner: - +-- Name: job_id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.que_jobs ALTER COLUMN job_id SET DEFAULT nextval('public.que_jobs_job_id_seq'::regclass); -- --- Name: registrant_verifications id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrant_verifications ALTER COLUMN id SET DEFAULT nextval('public.registrant_verifications_id_seq'::regclass); -- --- Name: registrars id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrars ALTER COLUMN id SET DEFAULT nextval('public.registrars_id_seq'::regclass); -- --- Name: reserved_domains id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.reserved_domains ALTER COLUMN id SET DEFAULT nextval('public.reserved_domains_id_seq'::regclass); -- --- Name: settings id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.settings ALTER COLUMN id SET DEFAULT nextval('public.settings_id_seq'::regclass); -- --- Name: users id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); -- --- Name: versions id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.versions ALTER COLUMN id SET DEFAULT nextval('public.versions_id_seq'::regclass); -- --- Name: white_ips id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.white_ips ALTER COLUMN id SET DEFAULT nextval('public.white_ips_id_seq'::regclass); -- --- Name: whois_records id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.whois_records ALTER COLUMN id SET DEFAULT nextval('public.whois_records_id_seq'::regclass); -- --- Name: zones id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.zones ALTER COLUMN id SET DEFAULT nextval('public.zones_id_seq'::regclass); -- --- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.contacts - ADD CONSTRAINT contacts_pkey PRIMARY KEY (id); - - --- --- Name: account_activities account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.account_activities @@ -2840,7 +2773,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: accounts accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.accounts @@ -2848,7 +2781,7 @@ ALTER TABLE ONLY public.accounts -- --- Name: actions actions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: actions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.actions @@ -2856,7 +2789,7 @@ ALTER TABLE ONLY public.actions -- --- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.ar_internal_metadata @@ -2864,7 +2797,7 @@ ALTER TABLE ONLY public.ar_internal_metadata -- --- Name: auctions auctions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: auctions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.auctions @@ -2872,7 +2805,7 @@ ALTER TABLE ONLY public.auctions -- --- Name: bank_statements bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.bank_statements @@ -2880,7 +2813,7 @@ ALTER TABLE ONLY public.bank_statements -- --- Name: bank_transactions bank_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: bank_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.bank_transactions @@ -2888,7 +2821,7 @@ ALTER TABLE ONLY public.bank_transactions -- --- Name: blocked_domains blocked_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: blocked_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.blocked_domains @@ -2896,7 +2829,7 @@ ALTER TABLE ONLY public.blocked_domains -- --- Name: certificates certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.certificates @@ -2904,7 +2837,7 @@ ALTER TABLE ONLY public.certificates -- --- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.contacts @@ -2912,7 +2845,7 @@ ALTER TABLE ONLY public.contacts -- --- Name: directos directos_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: directos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.directos @@ -2920,7 +2853,7 @@ ALTER TABLE ONLY public.directos -- --- Name: disputes disputes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: disputes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.disputes @@ -2928,7 +2861,7 @@ ALTER TABLE ONLY public.disputes -- --- Name: dnskeys dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.dnskeys @@ -2936,7 +2869,7 @@ ALTER TABLE ONLY public.dnskeys -- --- Name: domain_contacts domain_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: domain_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.domain_contacts @@ -2944,7 +2877,7 @@ ALTER TABLE ONLY public.domain_contacts -- --- Name: domain_transfers domain_transfers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: domain_transfers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.domain_transfers @@ -2952,7 +2885,7 @@ ALTER TABLE ONLY public.domain_transfers -- --- Name: domains domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.domains @@ -2960,7 +2893,7 @@ ALTER TABLE ONLY public.domains -- --- Name: epp_sessions epp_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: epp_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.epp_sessions @@ -2968,7 +2901,7 @@ ALTER TABLE ONLY public.epp_sessions -- --- Name: invoice_items invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.invoice_items @@ -2976,7 +2909,7 @@ ALTER TABLE ONLY public.invoice_items -- --- Name: invoices invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.invoices @@ -2984,7 +2917,7 @@ ALTER TABLE ONLY public.invoices -- --- Name: legal_documents legal_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: legal_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.legal_documents @@ -2992,7 +2925,7 @@ ALTER TABLE ONLY public.legal_documents -- --- Name: log_account_activities log_account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_account_activities @@ -3000,7 +2933,7 @@ ALTER TABLE ONLY public.log_account_activities -- --- Name: log_accounts log_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_accounts @@ -3008,7 +2941,7 @@ ALTER TABLE ONLY public.log_accounts -- --- Name: log_actions log_actions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_actions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_actions @@ -3016,7 +2949,7 @@ ALTER TABLE ONLY public.log_actions -- --- Name: log_bank_statements log_bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_bank_statements_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_bank_statements @@ -3024,7 +2957,7 @@ ALTER TABLE ONLY public.log_bank_statements -- --- Name: log_bank_transactions log_bank_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_bank_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_bank_transactions @@ -3032,7 +2965,7 @@ ALTER TABLE ONLY public.log_bank_transactions -- --- Name: log_blocked_domains log_blocked_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_blocked_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_blocked_domains @@ -3040,7 +2973,7 @@ ALTER TABLE ONLY public.log_blocked_domains -- --- Name: log_certificates log_certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_certificates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_certificates @@ -3048,7 +2981,7 @@ ALTER TABLE ONLY public.log_certificates -- --- Name: log_contacts log_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_contacts @@ -3056,7 +2989,7 @@ ALTER TABLE ONLY public.log_contacts -- --- Name: log_dnskeys log_dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_dnskeys @@ -3064,7 +2997,7 @@ ALTER TABLE ONLY public.log_dnskeys -- --- Name: log_domain_contacts log_domain_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_domain_contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_domain_contacts @@ -3072,7 +3005,7 @@ ALTER TABLE ONLY public.log_domain_contacts -- --- Name: log_domains log_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_domains @@ -3080,7 +3013,7 @@ ALTER TABLE ONLY public.log_domains -- --- Name: log_invoice_items log_invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_invoice_items @@ -3088,7 +3021,7 @@ ALTER TABLE ONLY public.log_invoice_items -- --- Name: log_invoices log_invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_invoices @@ -3096,7 +3029,7 @@ ALTER TABLE ONLY public.log_invoices -- --- Name: log_nameservers log_nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_nameservers @@ -3104,7 +3037,7 @@ ALTER TABLE ONLY public.log_nameservers -- --- Name: log_notifications log_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_notifications @@ -3112,7 +3045,7 @@ ALTER TABLE ONLY public.log_notifications -- --- Name: log_payment_orders log_payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_payment_orders @@ -3120,7 +3053,7 @@ ALTER TABLE ONLY public.log_payment_orders -- --- Name: log_registrant_verifications log_registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_registrant_verifications @@ -3128,7 +3061,7 @@ ALTER TABLE ONLY public.log_registrant_verifications -- --- Name: log_registrars log_registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_registrars @@ -3136,7 +3069,7 @@ ALTER TABLE ONLY public.log_registrars -- --- Name: log_reserved_domains log_reserved_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_reserved_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_reserved_domains @@ -3144,7 +3077,7 @@ ALTER TABLE ONLY public.log_reserved_domains -- --- Name: log_settings log_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_settings @@ -3152,7 +3085,7 @@ ALTER TABLE ONLY public.log_settings -- --- Name: log_users log_users_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_users @@ -3160,7 +3093,7 @@ ALTER TABLE ONLY public.log_users -- --- Name: log_white_ips log_white_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_white_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_white_ips @@ -3168,7 +3101,7 @@ ALTER TABLE ONLY public.log_white_ips -- --- Name: nameservers nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.nameservers @@ -3176,7 +3109,7 @@ ALTER TABLE ONLY public.nameservers -- --- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.notifications @@ -3184,7 +3117,7 @@ ALTER TABLE ONLY public.notifications -- --- Name: payment_orders payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: payment_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.payment_orders @@ -3192,7 +3125,7 @@ ALTER TABLE ONLY public.payment_orders -- --- Name: prices prices_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.prices @@ -3200,7 +3133,7 @@ ALTER TABLE ONLY public.prices -- --- Name: que_jobs que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: que_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.que_jobs @@ -3208,7 +3141,7 @@ ALTER TABLE ONLY public.que_jobs -- --- Name: registrant_verifications registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: registrant_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.registrant_verifications @@ -3216,7 +3149,7 @@ ALTER TABLE ONLY public.registrant_verifications -- --- Name: registrars registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.registrars @@ -3224,7 +3157,7 @@ ALTER TABLE ONLY public.registrars -- --- Name: reserved_domains reserved_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: reserved_domains_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.reserved_domains @@ -3232,7 +3165,7 @@ ALTER TABLE ONLY public.reserved_domains -- --- Name: settings settings_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.settings @@ -3240,7 +3173,7 @@ ALTER TABLE ONLY public.settings -- --- Name: blocked_domains uniq_blocked_domains_name; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: uniq_blocked_domains_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.blocked_domains @@ -3248,7 +3181,7 @@ ALTER TABLE ONLY public.blocked_domains -- --- Name: contacts uniq_contact_uuid; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: uniq_contact_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.contacts @@ -3256,7 +3189,7 @@ ALTER TABLE ONLY public.contacts -- --- Name: domains uniq_domain_uuid; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: uniq_domain_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.domains @@ -3264,7 +3197,7 @@ ALTER TABLE ONLY public.domains -- --- Name: reserved_domains uniq_reserved_domains_name; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: uniq_reserved_domains_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.reserved_domains @@ -3272,7 +3205,7 @@ ALTER TABLE ONLY public.reserved_domains -- --- Name: auctions uniq_uuid; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: uniq_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.auctions @@ -3280,7 +3213,7 @@ ALTER TABLE ONLY public.auctions -- --- Name: registrars unique_code; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.registrars @@ -3288,7 +3221,7 @@ ALTER TABLE ONLY public.registrars -- --- Name: contacts unique_contact_code; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: unique_contact_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.contacts @@ -3296,7 +3229,7 @@ ALTER TABLE ONLY public.contacts -- --- Name: registrars unique_name; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: unique_name; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.registrars @@ -3304,7 +3237,7 @@ ALTER TABLE ONLY public.registrars -- --- Name: invoices unique_number; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: unique_number; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.invoices @@ -3312,7 +3245,7 @@ ALTER TABLE ONLY public.invoices -- --- Name: registrars unique_reference_no; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: unique_reference_no; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.registrars @@ -3320,7 +3253,7 @@ ALTER TABLE ONLY public.registrars -- --- Name: auctions unique_registration_code; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: unique_registration_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.auctions @@ -3328,7 +3261,7 @@ ALTER TABLE ONLY public.auctions -- --- Name: epp_sessions unique_session_id; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: unique_session_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.epp_sessions @@ -3336,7 +3269,7 @@ ALTER TABLE ONLY public.epp_sessions -- --- Name: zones unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.zones @@ -3344,7 +3277,7 @@ ALTER TABLE ONLY public.zones -- --- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.users @@ -3352,7 +3285,7 @@ ALTER TABLE ONLY public.users -- --- Name: versions versions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.versions @@ -3360,7 +3293,7 @@ ALTER TABLE ONLY public.versions -- --- Name: white_ips white_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: white_ips_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.white_ips @@ -3368,7 +3301,7 @@ ALTER TABLE ONLY public.white_ips -- --- Name: whois_records whois_records_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: whois_records_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.whois_records @@ -3376,7 +3309,7 @@ ALTER TABLE ONLY public.whois_records -- --- Name: zones zones_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: zones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.zones @@ -3384,602 +3317,581 @@ ALTER TABLE ONLY public.zones -- --- Name: contacts_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX contacts_object_id_idx ON audit.contacts USING btree (object_id); - - --- --- Name: contacts_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX contacts_recorded_at_idx ON audit.contacts USING btree (recorded_at); - - --- --- Name: index_account_activities_on_account_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_account_activities_on_account_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_account_activities_on_account_id ON public.account_activities USING btree (account_id); -- --- Name: index_account_activities_on_bank_transaction_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_account_activities_on_bank_transaction_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_account_activities_on_bank_transaction_id ON public.account_activities USING btree (bank_transaction_id); -- --- Name: index_account_activities_on_invoice_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_account_activities_on_invoice_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_account_activities_on_invoice_id ON public.account_activities USING btree (invoice_id); -- --- Name: index_accounts_on_registrar_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_accounts_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_accounts_on_registrar_id ON public.accounts USING btree (registrar_id); -- --- Name: index_certificates_on_api_user_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_certificates_on_api_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_certificates_on_api_user_id ON public.certificates USING btree (api_user_id); -- --- Name: index_contacts_on_code; Type: INDEX; Schema: public; Owner: - +-- Name: index_contacts_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_contacts_on_code ON public.contacts USING btree (code); -- --- Name: index_contacts_on_registrar_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_contacts_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_contacts_on_registrar_id ON public.contacts USING btree (registrar_id); -- --- Name: index_contacts_on_registrar_id_and_ident_type; Type: INDEX; Schema: public; Owner: - +-- Name: index_contacts_on_registrar_id_and_ident_type; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_contacts_on_registrar_id_and_ident_type ON public.contacts USING btree (registrar_id, ident_type); -- --- Name: index_directos_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_directos_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_directos_on_item_type_and_item_id ON public.directos USING btree (item_type, item_id); -- --- Name: index_dnskeys_on_domain_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_dnskeys_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_dnskeys_on_domain_id ON public.dnskeys USING btree (domain_id); -- --- Name: index_dnskeys_on_legacy_domain_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_dnskeys_on_legacy_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_dnskeys_on_legacy_domain_id ON public.dnskeys USING btree (legacy_domain_id); -- --- Name: index_domain_contacts_on_contact_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_domain_contacts_on_contact_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domain_contacts_on_contact_id ON public.domain_contacts USING btree (contact_id); -- --- Name: index_domain_contacts_on_domain_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_domain_contacts_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domain_contacts_on_domain_id ON public.domain_contacts USING btree (domain_id); -- --- Name: index_domain_transfers_on_domain_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_domain_transfers_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domain_transfers_on_domain_id ON public.domain_transfers USING btree (domain_id); -- --- Name: index_domains_on_delete_date; Type: INDEX; Schema: public; Owner: - +-- Name: index_domains_on_delete_date; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domains_on_delete_date ON public.domains USING btree (delete_date); -- --- Name: index_domains_on_name; Type: INDEX; Schema: public; Owner: - +-- Name: index_domains_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_domains_on_name ON public.domains USING btree (name); -- --- Name: index_domains_on_outzone_at; Type: INDEX; Schema: public; Owner: - +-- Name: index_domains_on_outzone_at; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domains_on_outzone_at ON public.domains USING btree (outzone_at); -- --- Name: index_domains_on_registrant_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_domains_on_registrant_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domains_on_registrant_id ON public.domains USING btree (registrant_id); -- --- Name: index_domains_on_registrant_verification_asked_at; Type: INDEX; Schema: public; Owner: - +-- Name: index_domains_on_registrant_verification_asked_at; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domains_on_registrant_verification_asked_at ON public.domains USING btree (registrant_verification_asked_at); -- --- Name: index_domains_on_registrant_verification_token; Type: INDEX; Schema: public; Owner: - +-- Name: index_domains_on_registrant_verification_token; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domains_on_registrant_verification_token ON public.domains USING btree (registrant_verification_token); -- --- Name: index_domains_on_registrar_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_domains_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domains_on_registrar_id ON public.domains USING btree (registrar_id); -- --- Name: index_domains_on_statuses; Type: INDEX; Schema: public; Owner: - +-- Name: index_domains_on_statuses; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_domains_on_statuses ON public.domains USING gin (statuses); -- --- Name: index_epp_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: - +-- Name: index_epp_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_epp_sessions_on_updated_at ON public.epp_sessions USING btree (updated_at); -- --- Name: index_invoice_items_on_invoice_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_invoice_items_on_invoice_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_invoice_items_on_invoice_id ON public.invoice_items USING btree (invoice_id); -- --- Name: index_invoices_on_buyer_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_invoices_on_buyer_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_invoices_on_buyer_id ON public.invoices USING btree (buyer_id); -- --- Name: index_legal_documents_on_checksum; Type: INDEX; Schema: public; Owner: - +-- Name: index_legal_documents_on_checksum; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_legal_documents_on_checksum ON public.legal_documents USING btree (checksum); -- --- Name: index_legal_documents_on_documentable_type_and_documentable_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_legal_documents_on_documentable_type_and_documentable_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_legal_documents_on_documentable_type_and_documentable_id ON public.legal_documents USING btree (documentable_type, documentable_id); -- --- Name: index_log_account_activities_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_account_activities_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_account_activities_on_item_type_and_item_id ON public.log_account_activities USING btree (item_type, item_id); -- --- Name: index_log_account_activities_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_account_activities_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_account_activities_on_whodunnit ON public.log_account_activities USING btree (whodunnit); -- --- Name: index_log_accounts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_accounts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_accounts_on_item_type_and_item_id ON public.log_accounts USING btree (item_type, item_id); -- --- Name: index_log_accounts_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_accounts_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_accounts_on_whodunnit ON public.log_accounts USING btree (whodunnit); -- --- Name: index_log_bank_statements_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_bank_statements_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_bank_statements_on_item_type_and_item_id ON public.log_bank_statements USING btree (item_type, item_id); -- --- Name: index_log_bank_statements_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_bank_statements_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_bank_statements_on_whodunnit ON public.log_bank_statements USING btree (whodunnit); -- --- Name: index_log_bank_transactions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_bank_transactions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_bank_transactions_on_item_type_and_item_id ON public.log_bank_transactions USING btree (item_type, item_id); -- --- Name: index_log_bank_transactions_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_bank_transactions_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_bank_transactions_on_whodunnit ON public.log_bank_transactions USING btree (whodunnit); -- --- Name: index_log_blocked_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_blocked_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_blocked_domains_on_item_type_and_item_id ON public.log_blocked_domains USING btree (item_type, item_id); -- --- Name: index_log_blocked_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_blocked_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_blocked_domains_on_whodunnit ON public.log_blocked_domains USING btree (whodunnit); -- --- Name: index_log_certificates_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_certificates_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_certificates_on_item_type_and_item_id ON public.log_certificates USING btree (item_type, item_id); -- --- Name: index_log_certificates_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_certificates_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_certificates_on_whodunnit ON public.log_certificates USING btree (whodunnit); -- --- Name: index_log_contacts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_contacts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_contacts_on_item_type_and_item_id ON public.log_contacts USING btree (item_type, item_id); -- --- Name: index_log_contacts_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_contacts_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_contacts_on_whodunnit ON public.log_contacts USING btree (whodunnit); -- --- Name: index_log_dnskeys_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_dnskeys_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_dnskeys_on_item_type_and_item_id ON public.log_dnskeys USING btree (item_type, item_id); -- --- Name: index_log_dnskeys_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_dnskeys_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_dnskeys_on_whodunnit ON public.log_dnskeys USING btree (whodunnit); -- --- Name: index_log_domain_contacts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_domain_contacts_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_domain_contacts_on_item_type_and_item_id ON public.log_domain_contacts USING btree (item_type, item_id); -- --- Name: index_log_domain_contacts_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_domain_contacts_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_domain_contacts_on_whodunnit ON public.log_domain_contacts USING btree (whodunnit); -- --- Name: index_log_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_domains_on_item_type_and_item_id ON public.log_domains USING btree (item_type, item_id); -- --- Name: index_log_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_domains_on_whodunnit ON public.log_domains USING btree (whodunnit); -- --- Name: index_log_invoice_items_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_invoice_items_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_invoice_items_on_item_type_and_item_id ON public.log_invoice_items USING btree (item_type, item_id); -- --- Name: index_log_invoice_items_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_invoice_items_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_invoice_items_on_whodunnit ON public.log_invoice_items USING btree (whodunnit); -- --- Name: index_log_invoices_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_invoices_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_invoices_on_item_type_and_item_id ON public.log_invoices USING btree (item_type, item_id); -- --- Name: index_log_invoices_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_invoices_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_invoices_on_whodunnit ON public.log_invoices USING btree (whodunnit); -- --- Name: index_log_nameservers_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_nameservers_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_nameservers_on_item_type_and_item_id ON public.log_nameservers USING btree (item_type, item_id); -- --- Name: index_log_nameservers_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_nameservers_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_nameservers_on_whodunnit ON public.log_nameservers USING btree (whodunnit); -- --- Name: index_log_notifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_notifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_notifications_on_item_type_and_item_id ON public.log_notifications USING btree (item_type, item_id); -- --- Name: index_log_notifications_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_notifications_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_notifications_on_whodunnit ON public.log_notifications USING btree (whodunnit); -- --- Name: index_log_registrant_verifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_registrant_verifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_registrant_verifications_on_item_type_and_item_id ON public.log_registrant_verifications USING btree (item_type, item_id); -- --- Name: index_log_registrant_verifications_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_registrant_verifications_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_registrant_verifications_on_whodunnit ON public.log_registrant_verifications USING btree (whodunnit); -- --- Name: index_log_registrars_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_registrars_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_registrars_on_item_type_and_item_id ON public.log_registrars USING btree (item_type, item_id); -- --- Name: index_log_registrars_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_registrars_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_registrars_on_whodunnit ON public.log_registrars USING btree (whodunnit); -- --- Name: index_log_reserved_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_reserved_domains_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_reserved_domains_on_item_type_and_item_id ON public.log_reserved_domains USING btree (item_type, item_id); -- --- Name: index_log_reserved_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_reserved_domains_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_reserved_domains_on_whodunnit ON public.log_reserved_domains USING btree (whodunnit); -- --- Name: index_log_settings_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_settings_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_settings_on_item_type_and_item_id ON public.log_settings USING btree (item_type, item_id); -- --- Name: index_log_settings_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_settings_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_settings_on_whodunnit ON public.log_settings USING btree (whodunnit); -- --- Name: index_log_users_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_users_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_users_on_item_type_and_item_id ON public.log_users USING btree (item_type, item_id); -- --- Name: index_log_users_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_users_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_users_on_whodunnit ON public.log_users USING btree (whodunnit); -- --- Name: index_nameservers_on_domain_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_nameservers_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_nameservers_on_domain_id ON public.nameservers USING btree (domain_id); -- --- Name: index_notifications_on_registrar_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_notifications_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_notifications_on_registrar_id ON public.notifications USING btree (registrar_id); -- --- Name: index_payment_orders_on_invoice_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_payment_orders_on_invoice_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_payment_orders_on_invoice_id ON public.payment_orders USING btree (invoice_id); -- --- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_prices_on_zone_id ON public.prices USING btree (zone_id); -- --- Name: index_registrant_verifications_on_created_at; Type: INDEX; Schema: public; Owner: - +-- Name: index_registrant_verifications_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_registrant_verifications_on_created_at ON public.registrant_verifications USING btree (created_at); -- --- Name: index_registrant_verifications_on_domain_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_registrant_verifications_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_registrant_verifications_on_domain_id ON public.registrant_verifications USING btree (domain_id); -- --- Name: index_settings_on_thing_type_and_thing_id_and_var; Type: INDEX; Schema: public; Owner: - +-- Name: index_settings_on_thing_type_and_thing_id_and_var; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_settings_on_thing_type_and_thing_id_and_var ON public.settings USING btree (thing_type, thing_id, var); -- --- Name: index_users_on_identity_code; Type: INDEX; Schema: public; Owner: - +-- Name: index_users_on_identity_code; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_users_on_identity_code ON public.users USING btree (identity_code); -- --- Name: index_users_on_registrar_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_users_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_users_on_registrar_id ON public.users USING btree (registrar_id); -- --- Name: index_versions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_versions_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_versions_on_item_type_and_item_id ON public.versions USING btree (item_type, item_id); -- --- Name: index_whois_records_on_domain_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_whois_records_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_whois_records_on_domain_id ON public.whois_records USING btree (domain_id); -- --- Name: index_whois_records_on_registrar_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_whois_records_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_whois_records_on_registrar_id ON public.whois_records USING btree (registrar_id); -- --- Name: log_contacts_object_legacy_id; Type: INDEX; Schema: public; Owner: - +-- Name: log_contacts_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX log_contacts_object_legacy_id ON public.log_contacts USING btree ((((object ->> 'legacy_id'::text))::integer)); -- --- Name: log_dnskeys_object_legacy_id; Type: INDEX; Schema: public; Owner: - +-- Name: log_dnskeys_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX log_dnskeys_object_legacy_id ON public.log_contacts USING btree ((((object ->> 'legacy_domain_id'::text))::integer)); -- --- Name: log_domains_object_legacy_id; Type: INDEX; Schema: public; Owner: - +-- Name: log_domains_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX log_domains_object_legacy_id ON public.log_contacts USING btree ((((object ->> 'legacy_id'::text))::integer)); -- --- Name: log_nameservers_object_legacy_id; Type: INDEX; Schema: public; Owner: - +-- Name: log_nameservers_object_legacy_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX log_nameservers_object_legacy_id ON public.log_contacts USING btree ((((object ->> 'legacy_domain_id'::text))::integer)); -- --- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: - +-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX unique_schema_migrations ON public.schema_migrations USING btree (version); -- --- Name: contacts process_contact_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_contact_audit AFTER INSERT OR DELETE OR UPDATE ON public.contacts FOR EACH ROW EXECUTE PROCEDURE public.process_contact_audit(); - - --- --- Name: contacts contacts_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: contacts_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts @@ -3987,7 +3899,7 @@ ALTER TABLE ONLY public.contacts -- --- Name: domain_contacts domain_contacts_contact_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domain_contacts_contact_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_contacts @@ -3995,7 +3907,7 @@ ALTER TABLE ONLY public.domain_contacts -- --- Name: domain_contacts domain_contacts_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domain_contacts_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_contacts @@ -4003,7 +3915,7 @@ ALTER TABLE ONLY public.domain_contacts -- --- Name: domains domains_registrant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domains_registrant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domains @@ -4011,7 +3923,7 @@ ALTER TABLE ONLY public.domains -- --- Name: domains domains_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: domains_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domains @@ -4019,7 +3931,7 @@ ALTER TABLE ONLY public.domains -- --- Name: invoices fk_rails_242b91538b; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_242b91538b; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoices @@ -4027,7 +3939,7 @@ ALTER TABLE ONLY public.invoices -- --- Name: white_ips fk_rails_36cff3de9c; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_36cff3de9c; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.white_ips @@ -4035,7 +3947,7 @@ ALTER TABLE ONLY public.white_ips -- --- Name: domain_transfers fk_rails_59c422f73d; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_59c422f73d; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers @@ -4043,7 +3955,7 @@ ALTER TABLE ONLY public.domain_transfers -- --- Name: prices fk_rails_78c376257f; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_78c376257f; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.prices @@ -4051,7 +3963,7 @@ ALTER TABLE ONLY public.prices -- --- Name: domain_transfers fk_rails_833ed7f3c0; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_833ed7f3c0; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers @@ -4059,7 +3971,7 @@ ALTER TABLE ONLY public.domain_transfers -- --- Name: account_activities fk_rails_86cd2b09f5; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_86cd2b09f5; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -4067,7 +3979,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: domain_transfers fk_rails_87b8e40c63; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_87b8e40c63; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_transfers @@ -4075,7 +3987,7 @@ ALTER TABLE ONLY public.domain_transfers -- --- Name: actions fk_rails_8c6b5c12eb; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_8c6b5c12eb; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.actions @@ -4083,7 +3995,7 @@ ALTER TABLE ONLY public.actions -- --- Name: notifications fk_rails_8f9734b530; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_8f9734b530; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.notifications @@ -4091,7 +4003,7 @@ ALTER TABLE ONLY public.notifications -- --- Name: actions fk_rails_a5ae3c203d; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_a5ae3c203d; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.actions @@ -4099,7 +4011,7 @@ ALTER TABLE ONLY public.actions -- --- Name: epp_sessions fk_rails_adff2dc8e3; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_adff2dc8e3; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.epp_sessions @@ -4107,7 +4019,7 @@ ALTER TABLE ONLY public.epp_sessions -- --- Name: account_activities fk_rails_b80dbb973d; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_b80dbb973d; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -4115,7 +4027,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: accounts fk_rails_c9f635c0b3; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_c9f635c0b3; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.accounts @@ -4123,7 +4035,7 @@ ALTER TABLE ONLY public.accounts -- --- Name: account_activities fk_rails_ce38d749f6; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_ce38d749f6; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -4131,7 +4043,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: account_activities fk_rails_d2cc3c2fa9; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_d2cc3c2fa9; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -4139,7 +4051,7 @@ ALTER TABLE ONLY public.account_activities -- --- Name: registrant_verifications fk_rails_f41617a0e9; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_f41617a0e9; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.registrant_verifications @@ -4147,7 +4059,7 @@ ALTER TABLE ONLY public.registrant_verifications -- --- Name: payment_orders fk_rails_f9dc5857c3; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: fk_rails_f9dc5857c3; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.payment_orders @@ -4155,7 +4067,7 @@ ALTER TABLE ONLY public.payment_orders -- --- Name: invoice_items invoice_items_invoice_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: invoice_items_invoice_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.invoice_items @@ -4163,7 +4075,7 @@ ALTER TABLE ONLY public.invoice_items -- --- Name: notifications messages_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: messages_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.notifications @@ -4171,7 +4083,7 @@ ALTER TABLE ONLY public.notifications -- --- Name: nameservers nameservers_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: nameservers_domain_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.nameservers @@ -4179,7 +4091,7 @@ ALTER TABLE ONLY public.nameservers -- --- Name: users user_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: user_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.users @@ -4602,10 +4514,5 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200130092113'), ('20200203143458'), ('20200204103125'), -('20200310105731'), -('20200310105736'), -('20200311111515'), ('20200311114649'), ('20200421093637'); - - From 2525f14a18bbd7261685a77b8b50037d1ff66d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 5 May 2020 18:10:51 +0300 Subject: [PATCH 21/43] Add dispute_period_in_months to Setting --- ...20200505150413_add_dispute_period_in_months_to_setting.rb | 5 +++++ db/structure.sql | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20200505150413_add_dispute_period_in_months_to_setting.rb diff --git a/db/migrate/20200505150413_add_dispute_period_in_months_to_setting.rb b/db/migrate/20200505150413_add_dispute_period_in_months_to_setting.rb new file mode 100644 index 000000000..cffa91b7f --- /dev/null +++ b/db/migrate/20200505150413_add_dispute_period_in_months_to_setting.rb @@ -0,0 +1,5 @@ +class AddDisputePeriodInMonthsToSetting < ActiveRecord::Migration[5.2] + def change + Setting.create(var: 'dispute_period_in_months', value: 36) + end +end diff --git a/db/structure.sql b/db/structure.sql index a810d977c..7200c0cf2 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -4515,4 +4515,6 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200203143458'), ('20200204103125'), ('20200311114649'), -('20200421093637'); +('20200421093637'), +('20200505150413'); + From fabcdf9b7e7c59ef45523cc92ef2bbf2b73dd084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 7 May 2020 16:20:09 +0300 Subject: [PATCH 22/43] Use reserved>pw element as disputed password --- app/models/epp/domain.rb | 7 +++---- lib/schemas/eis-1.0.xsd | 11 ----------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 17046a8f1..40c445ba7 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -156,7 +156,6 @@ class Epp::Domain < Domain at[:period_unit] = Epp::Domain.parse_period_unit_from_frame(frame) || 'y' at[:reserved_pw] = frame.css('reserved > pw').text - at[:disputed_pw] = frame.css('disputed > pw').text # at[:statuses] = domain_statuses_attrs(frame, action) at[:nameservers_attributes] = nameservers_attrs(frame, action) @@ -479,15 +478,15 @@ class Epp::Domain < Domain same_registrant_as_current = (registrant.code == frame.css('registrant').text) if !same_registrant_as_current && disputed? - disputed_pw = frame.css('disputed > pw').text + disputed_pw = frame.css('reserved > pw').text if disputed_pw.blank? - add_epp_error('2304', nil, nil, 'Required parameter missing; disputed' \ + add_epp_error('2304', nil, nil, 'Required parameter missing; reserved' \ 'pw element required for dispute domains') else dispute = Dispute.active.find_by(domain_name: name, password: disputed_pw) if dispute.nil? add_epp_error('2202', nil, nil, 'Invalid authorization information; '\ - 'invalid disputed>pw value') + 'invalid reserved>pw value') end end end diff --git a/lib/schemas/eis-1.0.xsd b/lib/schemas/eis-1.0.xsd index 6a6bc742d..ddb3602c0 100644 --- a/lib/schemas/eis-1.0.xsd +++ b/lib/schemas/eis-1.0.xsd @@ -25,7 +25,6 @@ - @@ -50,16 +49,6 @@ - - - - - - - - From bd8ffb7e1daa92fa86597b64cabc4ee3ac461f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 7 May 2020 16:22:48 +0300 Subject: [PATCH 23/43] Remove destroy button from closed disputes --- app/controllers/admin/disputes_controller.rb | 4 ++-- app/views/admin/disputes/index.html.erb | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 8292bc464..02773e4c7 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -44,8 +44,8 @@ module Admin # DELETE /admin/disputes/1 def delete - @dispute.destroy - redirect_to admin_disputes_url, notice: 'Dispute was successfully destroyed.' + @dispute.update(closed: true) + redirect_to admin_disputes_url, notice: 'Dispute was successfully closed.' end private diff --git a/app/views/admin/disputes/index.html.erb b/app/views/admin/disputes/index.html.erb index eea74f59a..3a72e7d41 100644 --- a/app/views/admin/disputes/index.html.erb +++ b/app/views/admin/disputes/index.html.erb @@ -136,9 +136,6 @@ <%= sort_link(@q, 'comment') %> - - <%= t(:actions) %> - @@ -159,10 +156,6 @@ <%= x.comment %> - - <%= link_to t(:delete), delete_admin_dispute_path(id: x.id), - data: { confirm: t(:are_you_sure) }, class: 'btn btn-danger btn-xs' %> - <% end %> From 4870dab8afb108ce01e7039f85eee724d3942277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Thu, 7 May 2020 16:40:37 +0300 Subject: [PATCH 24/43] Autoaccept registrant change if valid dispute password present --- app/models/domain.rb | 2 +- app/models/epp/domain.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 82921e3ab..d3296ab0c 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -185,7 +185,7 @@ class Domain < ApplicationRecord end attr_accessor :registrant_typeahead, :update_me, - :epp_pending_update, :epp_pending_delete, :reserved_pw, :disputed_pw + :epp_pending_update, :epp_pending_delete, :reserved_pw self.ignored_columns = %w[legacy_id legacy_registrar_id legacy_registrant_id] diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 40c445ba7..e478468ba 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -495,7 +495,7 @@ class Epp::Domain < Domain Setting.request_confrimation_on_registrant_change_enabled && frame.css('registrant').present? && frame.css('registrant').attr('verified').to_s.downcase != 'yes' - registrant_verification_asked!(frame.to_s, current_user.id) + registrant_verification_asked!(frame.to_s, current_user.id) unless disputed? end errors.empty? && super(at) From dc9bf7a5d3e757d2548b805dffb8da28713dd05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 8 May 2020 13:50:48 +0300 Subject: [PATCH 25/43] Add reserved pw field to domain edit UI if active dispute --- app/controllers/registrar/domains_controller.rb | 1 + app/views/registrar/domains/form/_general.haml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb index e6e1029f6..b2c744d09 100644 --- a/app/controllers/registrar/domains_controller.rb +++ b/app/controllers/registrar/domains_controller.rb @@ -100,6 +100,7 @@ class Registrar authorize! :update, Depp::Domain @data = @domain.info(params[:domain_name]) @domain_params = Depp::Domain.construct_params_from_server_data(@data) + @disputed = Dispute.active.find_by(domain_name: params[:domain_name]).present? end def update diff --git a/app/views/registrar/domains/form/_general.haml b/app/views/registrar/domains/form/_general.haml index 0a729a262..56858a916 100644 --- a/app/views/registrar/domains/form/_general.haml +++ b/app/views/registrar/domains/form/_general.haml @@ -31,7 +31,7 @@ .col-md-7 = check_box_tag 'domain[verified]', '1', @domain_params[:verified].eql?('1'), onclick: "return (confirm('#{t(:verified_confirm)}') ? true : false);" - - unless params[:domain_name] + - if !params[:domain_name] || @disputed .form-group .col-md-3.control-label = label_tag :domain_reserved_pw, t(:reserved_pw) From 529a8a1bf698bb48f35fa93d5e536c8a8029f74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 8 May 2020 15:48:48 +0300 Subject: [PATCH 26/43] Send unregistered domain to auction after dispute is closed --- app/models/dispute.rb | 12 ++++++++++-- app/models/dns/domain_name.rb | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/models/dispute.rb b/app/models/dispute.rb index b80a33e9c..a21ef28f7 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -55,8 +55,16 @@ class Dispute < ApplicationRecord return false unless update(closed: true) return if Dispute.active.where(domain_name: domain_name).any? - whois_record = Whois::Record.find_or_initialize_by(name: domain_name) - return true if remove_whois_data(whois_record) + domain = DNS::DomainName.new(domain_name) + if domain.available? && domain.auctionable? + domain.sell_at_auction + return true + else + whois_record = Whois::Record.find_or_initialize_by(name: domain_name) + return true if remove_whois_data(whois_record) + end + + false end def remove_whois_data(record) diff --git a/app/models/dns/domain_name.rb b/app/models/dns/domain_name.rb index c1af4d5e7..7df38341c 100644 --- a/app/models/dns/domain_name.rb +++ b/app/models/dns/domain_name.rb @@ -29,6 +29,8 @@ module DNS :at_auction elsif awaiting_payment? :awaiting_payment + elsif disputed? + :disputed end end From 5e152b3b9d897b6abe3be0c38b5257b5f6bbb7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 11 May 2020 13:54:22 +0300 Subject: [PATCH 27/43] Validate Dispute.starts_at is not in future --- app/models/dispute.rb | 7 ++----- app/views/admin/disputes/_form.html.erb | 2 +- config/locales/admin/disputes.en.yml | 9 ++++++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/models/dispute.rb b/app/models/dispute.rb index a21ef28f7..031e15855 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -4,10 +4,7 @@ class Dispute < ApplicationRecord before_validation :set_expiry_date validate :validate_domain_name_format validate :validate_domain_name_period_uniqueness - - with_options on: :admin do - validate :validate_start_date - end + validate :validate_start_date before_save :set_expiry_date before_save :sync_reserved_password @@ -112,7 +109,7 @@ class Dispute < ApplicationRecord def validate_start_date return if starts_at.nil? - errors.add(:starts_at, :past) if starts_at.past? + errors.add(:starts_at, :future) if starts_at.future? end def validate_domain_name_format diff --git a/app/views/admin/disputes/_form.html.erb b/app/views/admin/disputes/_form.html.erb index df2151c6c..2a3fb722f 100644 --- a/app/views/admin/disputes/_form.html.erb +++ b/app/views/admin/disputes/_form.html.erb @@ -36,7 +36,7 @@
<%= f.text_field(:starts_at, class: 'form-control js-datepicker') %> - <%= t '.in_future' %> + <%= t '.past_or_today' %>
diff --git a/config/locales/admin/disputes.en.yml b/config/locales/admin/disputes.en.yml index ba5b79099..072f0eebc 100644 --- a/config/locales/admin/disputes.en.yml +++ b/config/locales/admin/disputes.en.yml @@ -1,4 +1,11 @@ en: + activerecord: + errors: + models: + dispute: + attributes: + starts_at: + future: 'can not be greater than today' admin: disputes: index: @@ -9,4 +16,4 @@ en: form: password_hint: Generated automatically if left blank optional: Not required by default - in_future: Must be at least today / in future + past_or_today: Can not be greater than today's date From e7ad4a7c6427aa6cc190953394bd838b2884c393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 11 May 2020 16:06:35 +0300 Subject: [PATCH 28/43] Move domain dispute logic to concern --- app/models/concerns/domain/disputable.rb | 44 ++++++++++++++++++++ app/models/dispute.rb | 20 ++++++++- app/models/domain.rb | 29 ++----------- app/models/domain_status.rb | 3 +- app/models/whois_record.rb | 1 + test/integration/admin_area/disputes_test.rb | 2 +- 6 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 app/models/concerns/domain/disputable.rb diff --git a/app/models/concerns/domain/disputable.rb b/app/models/concerns/domain/disputable.rb new file mode 100644 index 000000000..757f10fd3 --- /dev/null +++ b/app/models/concerns/domain/disputable.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Concerns + module Domain + module Disputable + extend ActiveSupport::Concern + + included do + validate :validate_disputed + end + + def mark_as_disputed + statuses.push(DomainStatus::DISPUTED) unless statuses.include?(DomainStatus::DISPUTED) + save + end + + def unmark_as_disputed + statuses.delete_if { |status| status == DomainStatus::DISPUTED } + save + end + + def in_disputed_list? + @in_disputed_list ||= Dispute.active.find_by(domain_name: name).present? + end + + def disputed? + Dispute.active.where(domain_name: name).any? + end + + def validate_disputed + return if persisted? || !in_disputed_list? + + if reserved_pw.blank? + errors.add(:base, :required_parameter_missing_reserved) + return false + end + + return if Dispute.valid_auth?(name, reserved_pw) + + errors.add(:base, :invalid_auth_information_reserved) + end + end + end +end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 031e15855..279475e23 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -12,16 +12,24 @@ class Dispute < ApplicationRecord after_destroy :remove_data scope :expired, -> { where('expires_at < ?', Time.zone.today) } - scope :active, -> { where('expires_at >= ? AND closed = false', Time.zone.today) } + scope :active, lambda { + where('starts_at <= ? AND expires_at >= ? AND closed = false', Time.zone.today, Time.zone.today) + } scope :closed, -> { where(closed: true) } attr_readonly :domain_name alias_attribute :name, :domain_name + def domain + Domain.find_by(name: domain_name) + end + def self.close_by_domain(domain_name) dispute = Dispute.active.find_by(domain_name: domain_name) - dispute.update(closed: true) if dispute.present? + return false unless dispute + + dispute.close end def self.valid_auth?(domain_name, password) @@ -40,6 +48,12 @@ class Dispute < ApplicationRecord def generate_data return if starts_at > Time.zone.today + return if expires_at < Time.zone.today + + domain = Domain.find_by_idn(domain_name) + domain&.mark_as_disputed + + return if domain wr = Whois::Record.find_or_initialize_by(name: domain_name) wr.json = generate_json(wr) @@ -52,6 +66,8 @@ class Dispute < ApplicationRecord return false unless update(closed: true) return if Dispute.active.where(domain_name: domain_name).any? + Domain.find_by_idn(domain_name)&.unmark_as_disputed + domain = DNS::DomainName.new(domain_name) if domain.available? && domain.auctionable? domain.sell_at_auction diff --git a/app/models/domain.rb b/app/models/domain.rb index d3296ab0c..805b58309 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -9,6 +9,7 @@ class Domain < ApplicationRecord include Concerns::Domain::Transferable include Concerns::Domain::RegistryLockable include Concerns::Domain::Releasable + include Concerns::Domain::Disputable attr_accessor :roles @@ -88,9 +89,8 @@ class Domain < ApplicationRecord validates :puny_label, length: { maximum: 63 } validates :period, presence: true, numericality: { only_integer: true } validates :transfer_code, presence: true - validate :validate_reservation - validate :validate_disputed + def validate_reservation return if persisted? || !in_reserved_list? @@ -104,19 +104,6 @@ class Domain < ApplicationRecord errors.add(:base, :invalid_auth_information_reserved) end - def validate_disputed - return if persisted? || !in_disputed_list? - - if reserved_pw.blank? - errors.add(:base, :required_parameter_missing_reserved) - return false - end - - return if Dispute.valid_auth?(name, reserved_pw) - - errors.add(:base, :invalid_auth_information_reserved) - end - validate :status_is_consistant def status_is_consistant has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE)) @@ -290,14 +277,6 @@ class Domain < ApplicationRecord @in_reserved_list ||= ReservedDomain.by_domain(name).any? end - def in_disputed_list? - @in_disputed_list ||= Dispute.active.find_by(domain_name: name).present? - end - - def disputed? - Dispute.active.where(domain_name: name).any? - end - def pending_transfer transfers.find_by(status: DomainTransfer::PENDING) end @@ -318,8 +297,8 @@ class Domain < ApplicationRecord return false if statuses.include_any?(DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW, DomainStatus::PENDING_TRANSFER, DomainStatus::PENDING_DELETE, - DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION) - return false if disputed? + DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION, + DomainStatus::DISPUTED) true end diff --git a/app/models/domain_status.rb b/app/models/domain_status.rb index 4b1c49916..7a2f9d020 100644 --- a/app/models/domain_status.rb +++ b/app/models/domain_status.rb @@ -70,6 +70,7 @@ class DomainStatus < ApplicationRecord FORCE_DELETE = 'serverForceDelete' DELETE_CANDIDATE = 'deleteCandidate' EXPIRED = 'expired' + DISPUTED = 'disputed' STATUSES = [ CLIENT_DELETE_PROHIBITED, SERVER_DELETE_PROHIBITED, CLIENT_HOLD, SERVER_HOLD, @@ -78,7 +79,7 @@ class DomainStatus < ApplicationRecord INACTIVE, OK, PENDING_CREATE, PENDING_DELETE, PENDING_DELETE_CONFIRMATION, PENDING_RENEW, PENDING_TRANSFER, PENDING_UPDATE, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED, FORCE_DELETE, - DELETE_CANDIDATE, EXPIRED + DELETE_CANDIDATE, EXPIRED, DISPUTED ] CLIENT_STATUSES = [ diff --git a/app/models/whois_record.rb b/app/models/whois_record.rb index cace829fa..4994283c9 100644 --- a/app/models/whois_record.rb +++ b/app/models/whois_record.rb @@ -84,6 +84,7 @@ class WhoisRecord < ApplicationRecord def populate return if domain_id.blank? + self.json = generated_json self.name = json['name'] self.registrar_id = domain.registrar_id if domain # for faster registrar updates diff --git a/test/integration/admin_area/disputes_test.rb b/test/integration/admin_area/disputes_test.rb index 1806eaea4..cfda9d23d 100644 --- a/test/integration/admin_area/disputes_test.rb +++ b/test/integration/admin_area/disputes_test.rb @@ -60,7 +60,7 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase def test_deletes_dispute visit delete_admin_dispute_path(@dispute) - assert_text 'Dispute was successfully destroyed.' + assert_text 'Dispute was successfully closed.' end def test_can_not_create_overlapping_dispute From be14ede8b6b3bbdb21a24e5878e90b0aec200dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 12 May 2020 14:52:27 +0300 Subject: [PATCH 29/43] Refactor some dispute logic --- app/controllers/admin/disputes_controller.rb | 2 +- app/controllers/epp/domains_controller.rb | 2 +- app/models/dispute.rb | 45 ++++++++------------ app/models/dns/domain_name.rb | 2 - app/models/domain.rb | 21 ++++----- app/models/domain_status.rb | 8 ++-- app/models/epp/domain.rb | 6 ++- test/jobs/dispute_status_update_job_test.rb | 4 +- 8 files changed, 42 insertions(+), 48 deletions(-) diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 02773e4c7..03b4d4895 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -44,7 +44,7 @@ module Admin # DELETE /admin/disputes/1 def delete - @dispute.update(closed: true) + @dispute.close redirect_to admin_disputes_url, notice: 'Dispute was successfully closed.' end diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 4e91632e5..9655eddfa 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -106,7 +106,7 @@ module Epp updated = @domain.update(params[:parsed_frame], current_user) (handle_errors(@domain) && return) unless updated - Dispute.active.close_by_domain(@domain.name) if @domain.disputed? + Dispute.close_by_domain(@domain.name) if @domain.disputed? pending = @domain.epp_pending_update.present? render_epp_response "/epp/domains/success#{'_pending' if pending}" end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 279475e23..1d445bc56 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -1,14 +1,11 @@ class Dispute < ApplicationRecord validates :domain_name, :password, :starts_at, :expires_at, presence: true - before_validation :fill_empty_passwords - before_validation :set_expiry_date + before_validation :fill_empty_passwords, :set_expiry_date validate :validate_domain_name_format validate :validate_domain_name_period_uniqueness validate :validate_start_date - before_save :set_expiry_date - before_save :sync_reserved_password - before_save :generate_data + before_save :set_expiry_date, :sync_reserved_password, :generate_data after_destroy :remove_data scope :expired, -> { where('expires_at < ?', Time.zone.today) } @@ -19,8 +16,6 @@ class Dispute < ApplicationRecord attr_readonly :domain_name - alias_attribute :name, :domain_name - def domain Domain.find_by(name: domain_name) end @@ -47,12 +42,9 @@ class Dispute < ApplicationRecord end def generate_data - return if starts_at > Time.zone.today - return if expires_at < Time.zone.today + return if starts_at > Time.zone.today || expires_at < Time.zone.today - domain = Domain.find_by_idn(domain_name) domain&.mark_as_disputed - return if domain wr = Whois::Record.find_or_initialize_by(name: domain_name) @@ -60,32 +52,31 @@ class Dispute < ApplicationRecord wr.save end - alias_method :update_whois_record, :generate_data - def close return false unless update(closed: true) return if Dispute.active.where(domain_name: domain_name).any? - Domain.find_by_idn(domain_name)&.unmark_as_disputed + domain&.unmark_as_disputed + return true if domain + forward_to_auction_if_possible + end + + def forward_to_auction_if_possible domain = DNS::DomainName.new(domain_name) - if domain.available? && domain.auctionable? - domain.sell_at_auction - return true - else - whois_record = Whois::Record.find_or_initialize_by(name: domain_name) - return true if remove_whois_data(whois_record) - end + return domain.sell_at_auction if domain.available? && domain.auctionable? - false + whois_record = Whois::Record.find_by(name: domain_name) + remove_whois_data(whois_record) end def remove_whois_data(record) - record.json['status'] = record.json['status'].delete_if { |status| status == 'disputed' } - if record.json['status'].blank? - return true if record.destroy && record.json['status'].blank? - end - record.save + return true unless record + + record.json['status'].delete_if { |status| status == 'disputed' } + record.destroy && return if record.json['status'].blank? + + save end def generate_json(record) diff --git a/app/models/dns/domain_name.rb b/app/models/dns/domain_name.rb index 7df38341c..c1af4d5e7 100644 --- a/app/models/dns/domain_name.rb +++ b/app/models/dns/domain_name.rb @@ -29,8 +29,6 @@ module DNS :at_auction elsif awaiting_payment? :awaiting_payment - elsif disputed? - :disputed end end diff --git a/app/models/domain.rb b/app/models/domain.rb index 805b58309..fff0d4a08 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -284,21 +284,22 @@ class Domain < ApplicationRecord def server_holdable? return false if statuses.include?(DomainStatus::SERVER_HOLD) return false if statuses.include?(DomainStatus::SERVER_MANUAL_INZONE) + true end def renewable? - if Setting.days_to_renew_domain_before_expire != 0 - # if you can renew domain at days_to_renew before domain expiration - if (expire_time.to_date - Time.zone.today) + 1 > Setting.days_to_renew_domain_before_expire - return false - end - end + blocking_statuses = [DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW, + DomainStatus::PENDING_TRANSFER, DomainStatus::DISPUTED, + DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE, + DomainStatus::PENDING_DELETE_CONFIRMATION] + return false if statuses.include_any? blocking_statuses + return true unless Setting.days_to_renew_domain_before_expire != 0 - return false if statuses.include_any?(DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW, - DomainStatus::PENDING_TRANSFER, DomainStatus::PENDING_DELETE, - DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE_CONFIRMATION, - DomainStatus::DISPUTED) + # if you can renew domain at days_to_renew before domain expiration + if (expire_time.to_date - Time.zone.today) + 1 > Setting.days_to_renew_domain_before_expire + return false + end true end diff --git a/app/models/domain_status.rb b/app/models/domain_status.rb index 7a2f9d020..bf0ae2a51 100644 --- a/app/models/domain_status.rb +++ b/app/models/domain_status.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DomainStatus < ApplicationRecord include EppErrors belongs_to :domain @@ -80,18 +82,18 @@ class DomainStatus < ApplicationRecord PENDING_UPDATE, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED, FORCE_DELETE, DELETE_CANDIDATE, EXPIRED, DISPUTED - ] + ].freeze CLIENT_STATUSES = [ CLIENT_DELETE_PROHIBITED, CLIENT_HOLD, CLIENT_RENEW_PROHIBITED, CLIENT_TRANSFER_PROHIBITED, CLIENT_UPDATE_PROHIBITED - ] + ].freeze SERVER_STATUSES = [ SERVER_DELETE_PROHIBITED, SERVER_HOLD, SERVER_RENEW_PROHIBITED, SERVER_TRANSFER_PROHIBITED, SERVER_UPDATE_PROHIBITED, SERVER_MANUAL_INZONE, SERVER_REGISTRANT_CHANGE_PROHIBITED, SERVER_ADMIN_CHANGE_PROHIBITED, SERVER_TECH_CHANGE_PROHIBITED - ] + ].freeze UPDATE_PROHIBIT_STATES = [ DomainStatus::PENDING_DELETE_CONFIRMATION, diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index e478468ba..32c7a2667 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -491,10 +491,12 @@ class Epp::Domain < Domain end end + unverified_registrant_params = frame.css('registrant').present? && + frame.css('registrant').attr('verified').to_s.downcase != 'yes' + if !same_registrant_as_current && errors.empty? && verify && Setting.request_confrimation_on_registrant_change_enabled && - frame.css('registrant').present? && - frame.css('registrant').attr('verified').to_s.downcase != 'yes' + unverified_registrant_params registrant_verification_asked!(frame.to_s, current_user.id) unless disputed? end diff --git a/test/jobs/dispute_status_update_job_test.rb b/test/jobs/dispute_status_update_job_test.rb index a66db3459..64c7e000e 100644 --- a/test/jobs/dispute_status_update_job_test.rb +++ b/test/jobs/dispute_status_update_job_test.rb @@ -20,7 +20,7 @@ class DisputeStatusUpdateJobTest < ActiveSupport::TestCase assert_includes whois_record.json['status'], 'disputed' end - def test_unregistered_domain_whois_data_is_deleted + def test_on_expiry_unregistered_domain_is_sent_to_auction dispute = disputes(:active) dispute.update!(starts_at: Time.zone.today - 3.years - 1.day) @@ -30,7 +30,7 @@ class DisputeStatusUpdateJobTest < ActiveSupport::TestCase assert dispute.closed whois_record = Whois::Record.find_by(name: dispute.domain_name) - assert whois_record.nil? + assert_equal ['AtAuction'], whois_record.json['status'] end def test_registered_domain_whois_data_is_added From abc1920d45a643d32b08f06488a3a1a57127f1d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 15 May 2020 17:55:20 +0300 Subject: [PATCH 30/43] Fix dispute status removal when dispute is closed --- app/models/dispute.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 1d445bc56..7aaca65b1 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -48,7 +48,7 @@ class Dispute < ApplicationRecord return if domain wr = Whois::Record.find_or_initialize_by(name: domain_name) - wr.json = generate_json(wr) + wr.json = @json = generate_json(wr) wr.save end @@ -64,7 +64,7 @@ class Dispute < ApplicationRecord def forward_to_auction_if_possible domain = DNS::DomainName.new(domain_name) - return domain.sell_at_auction if domain.available? && domain.auctionable? + (domain.sell_at_auction && return) if domain.available? && domain.auctionable? whois_record = Whois::Record.find_by(name: domain_name) remove_whois_data(whois_record) @@ -73,10 +73,10 @@ class Dispute < ApplicationRecord def remove_whois_data(record) return true unless record - record.json['status'].delete_if { |status| status == 'disputed' } + record.json['status'] = record.json['status'].delete_if { |status| status == 'disputed' } record.destroy && return if record.json['status'].blank? - save + record.save end def generate_json(record) From 26a5813fe924a95dbf4ef5f48ab8bdd50e62e9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 18 May 2020 13:36:03 +0300 Subject: [PATCH 31/43] Improve wording for disputed domains --- config/locales/admin/disputes.en.yml | 4 ++-- config/locales/admin/menu.en.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/admin/disputes.en.yml b/config/locales/admin/disputes.en.yml index 072f0eebc..9632dde4a 100644 --- a/config/locales/admin/disputes.en.yml +++ b/config/locales/admin/disputes.en.yml @@ -9,8 +9,8 @@ en: admin: disputes: index: - title: Domain disputes - new_btn: New domain dispute + title: Disputed domains + new_btn: New disputed domain reset_btn: Reset form: diff --git a/config/locales/admin/menu.en.yml b/config/locales/admin/menu.en.yml index 1cb396ed6..617341c6a 100644 --- a/config/locales/admin/menu.en.yml +++ b/config/locales/admin/menu.en.yml @@ -13,7 +13,7 @@ en: zones: Zones blocked_domains: Blocked domains reserved_domains: Reserved domains - disputed_domains: Domain disputes + disputed_domains: Disputed domains epp_log: EPP log repp_log: REPP log que: Que From c682155bf657e4c1b358fa155147c7eb7472d0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 18 May 2020 15:11:34 +0300 Subject: [PATCH 32/43] Disputes: Show when and who closed dispute --- app/controllers/admin/disputes_controller.rb | 2 +- .../domain_update_confirms_controller.rb | 5 +---- app/jobs/dispute_status_update_job.rb | 6 +++--- app/models/dispute.rb | 12 ++++++------ app/views/admin/disputes/index.html.erb | 8 ++++---- ...closed_date_time_and_updator_to_dispute.rb | 19 +++++++++++++++++++ db/structure.sql | 15 +++++++++------ test/fixtures/disputes.yml | 6 ++---- test/integration/admin_area/disputes_test.rb | 6 +++--- 9 files changed, 48 insertions(+), 31 deletions(-) create mode 100644 db/migrate/20200518104105_add_closed_date_time_and_updator_to_dispute.rb diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 03b4d4895..450576aa3 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -44,7 +44,7 @@ module Admin # DELETE /admin/disputes/1 def delete - @dispute.close + @dispute.close(initiator: 'Admin') redirect_to admin_disputes_url, notice: 'Dispute was successfully closed.' end diff --git a/app/controllers/registrant/domain_update_confirms_controller.rb b/app/controllers/registrant/domain_update_confirms_controller.rb index 0b964ae2b..0e4f2a582 100644 --- a/app/controllers/registrant/domain_update_confirms_controller.rb +++ b/app/controllers/registrant/domain_update_confirms_controller.rb @@ -31,10 +31,7 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController end elsif params[:confirmed] if @registrant_verification.domain_registrant_change_confirm!("email link, #{initiator}") - if @domain.disputed? - dispute = Dispute.active.find_by(domain_name: @domain.name) - dispute.close - end + Dispute.close_by_domain(@domain.name) if @domain.disputed? flash[:notice] = t(:registrant_domain_verification_confirmed) redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true) diff --git a/app/jobs/dispute_status_update_job.rb b/app/jobs/dispute_status_update_job.rb index 736b65236..2a3f3445a 100644 --- a/app/jobs/dispute_status_update_job.rb +++ b/app/jobs/dispute_status_update_job.rb @@ -13,7 +13,7 @@ class DisputeStatusUpdateJob < Que::Job end def close_disputes - disputes = Dispute.where(closed: false).where('expires_at < ?', Time.zone.today).all + disputes = Dispute.where(closed: nil).where('expires_at < ?', Time.zone.today).all Rails.logger.info "DisputeStatusUpdateJob - Found #{disputes.count} closable disputes" disputes.each do |dispute| process_dispute(dispute, closing: true) @@ -21,7 +21,7 @@ class DisputeStatusUpdateJob < Que::Job end def activate_disputes - disputes = Dispute.where(closed: false, starts_at: Time.zone.today).all + disputes = Dispute.where(closed: nil, starts_at: Time.zone.today).all Rails.logger.info "DisputeStatusUpdateJob - Found #{disputes.count} activatable disputes" disputes.each do |dispute| @@ -31,7 +31,7 @@ class DisputeStatusUpdateJob < Que::Job def process_dispute(dispute, closing: false) intent = closing ? 'close' : 'activate' - success = closing ? dispute.close : dispute.generate_data + success = closing ? dispute.close(initiator: 'Job') : dispute.generate_data create_backlog_entry(dispute: dispute, intent: intent, successful: success) end diff --git a/app/models/dispute.rb b/app/models/dispute.rb index 7aaca65b1..7434c8e26 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -10,9 +10,9 @@ class Dispute < ApplicationRecord scope :expired, -> { where('expires_at < ?', Time.zone.today) } scope :active, lambda { - where('starts_at <= ? AND expires_at >= ? AND closed = false', Time.zone.today, Time.zone.today) + where('starts_at <= ? AND expires_at >= ? AND closed IS NULL', Time.zone.today, Time.zone.today) } - scope :closed, -> { where(closed: true) } + scope :closed, -> { where.not(closed: nil) } attr_readonly :domain_name @@ -24,7 +24,7 @@ class Dispute < ApplicationRecord dispute = Dispute.active.find_by(domain_name: domain_name) return false unless dispute - dispute.close + dispute.close(initiator: 'Registrant') end def self.valid_auth?(domain_name, password) @@ -52,8 +52,8 @@ class Dispute < ApplicationRecord wr.save end - def close - return false unless update(closed: true) + def close(initiator: 'Unknown') + return false unless update(closed: Time.zone.now, initiator: initiator) return if Dispute.active.where(domain_name: domain_name).any? domain&.unmark_as_disputed @@ -129,7 +129,7 @@ class Dispute < ApplicationRecord end def validate_domain_name_period_uniqueness - existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: false) + existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: nil) .where('expires_at >= ?', starts_at) existing_dispute = existing_dispute.where.not(id: id) unless new_record? diff --git a/app/views/admin/disputes/index.html.erb b/app/views/admin/disputes/index.html.erb index 3a72e7d41..c4bd094a9 100644 --- a/app/views/admin/disputes/index.html.erb +++ b/app/views/admin/disputes/index.html.erb @@ -125,13 +125,13 @@ <%= sort_link(@q, 'name') %> - <%= sort_link(@q, 'password') %> + <%= sort_link(@q, 'Initiator') %> <%= sort_link(@q, 'starts_at') %> - <%= sort_link(@q, 'expires_at') %> + <%= sort_link(@q, 'Expired/Closed At') %> <%= sort_link(@q, 'comment') %> @@ -145,13 +145,13 @@ <%= x.domain_name %> - <%= x.password %> + <%= x.initiator %> <%= x.starts_at %> - <%= x.expires_at %> + <%= x.closed %> <%= x.comment %> diff --git a/db/migrate/20200518104105_add_closed_date_time_and_updator_to_dispute.rb b/db/migrate/20200518104105_add_closed_date_time_and_updator_to_dispute.rb new file mode 100644 index 000000000..1aae02e06 --- /dev/null +++ b/db/migrate/20200518104105_add_closed_date_time_and_updator_to_dispute.rb @@ -0,0 +1,19 @@ +class AddClosedDateTimeAndUpdatorToDispute < ActiveRecord::Migration[5.2] + def up + rename_column :disputes, :closed, :closed_boolean + add_column :disputes, :closed, :datetime + execute 'UPDATE disputes SET closed = updated_at WHERE closed_boolean = true' + execute 'UPDATE disputes SET closed = NULL WHERE closed_boolean = false' + remove_column :disputes, :closed_boolean + add_column :disputes, :initiator, :string + end + + def down + rename_column :disputes, :closed, :closed_datetime + add_column :disputes, :closed, :boolean, null: false, default: false + execute 'UPDATE disputes SET closed = true WHERE closed_datetime != NULL' + execute 'UPDATE disputes SET closed = false WHERE closed_datetime = NULL' + remove_column :disputes, :closed_datetime + remove_column :disputes, :initiator + end +end diff --git a/db/structure.sql b/db/structure.sql index ff2a625d9..4104b2db5 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1,6 +1,6 @@ --- --- PostgreSQL database dump --- +--- +--- PostgreSQL database dump +--- SET statement_timeout = 0; SET lock_timeout = 0; @@ -605,9 +605,10 @@ CREATE TABLE public.disputes ( expires_at date NOT NULL, starts_at date NOT NULL, comment text, - closed boolean DEFAULT false NOT NULL, created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL + updated_at timestamp without time zone NOT NULL, + closed timestamp without time zone, + initiator character varying ); @@ -4520,5 +4521,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200417075720'), ('20200421093637'), ('20200505103316'), -('20200505150413'); +('20200505150413'), +('20200518104105'); + diff --git a/test/fixtures/disputes.yml b/test/fixtures/disputes.yml index 3e6b882f4..a999fa0a1 100644 --- a/test/fixtures/disputes.yml +++ b/test/fixtures/disputes.yml @@ -3,22 +3,20 @@ active: password: active-001 starts_at: <%= Date.parse '2010-07-05' %> expires_at: <%= Date.parse '2013-07-05' %> - closed: false future: domain_name: future-dispute.test password: active-001 starts_at: <%= Date.parse '2010-10-05' %> expires_at: <%= Date.parse '2013-10-05' %> - closed: false expired: domain_name: expired-dispute.test password: active-001 starts_at: <%= Date.parse '2010-07-05' %> expires_at: <%= Date.parse '2013-07-05' %> - closed: true + closed: <%= Date.parse '2013-07-05' %> closed: domain_name: closed_dispute.test password: active-001 starts_at: <%= Date.parse '2010-07-05' %> expires_at: <%= Date.parse '2013-07-05' %> - closed: true + closed: <%= Date.parse '2013-07-05' %> diff --git a/test/integration/admin_area/disputes_test.rb b/test/integration/admin_area/disputes_test.rb index cfda9d23d..b829e3b49 100644 --- a/test/integration/admin_area/disputes_test.rb +++ b/test/integration/admin_area/disputes_test.rb @@ -18,7 +18,7 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase assert_nil Dispute.active.find_by(domain_name: 'disputed.test') visit admin_disputes_path - click_on 'New domain dispute' + click_on 'New disputed domain' fill_in 'Domain name', with: 'disputed.test' fill_in 'Password', with: '1234' @@ -34,7 +34,7 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase assert_nil Dispute.active.find_by(domain_name: 'disputed.test') visit admin_disputes_path - click_on 'New domain dispute' + click_on 'New disputed domain' fill_in 'Domain name', with: 'disputed.test' fill_in 'Password', with: '1234' @@ -65,7 +65,7 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase def test_can_not_create_overlapping_dispute visit admin_disputes_path - click_on 'New domain dispute' + click_on 'New disputed domain' fill_in 'Domain name', with: 'active-dispute.test' fill_in 'Starts at', with: @dispute.starts_at + 1.day From 36f5ec734ee3e1ddd6524a42828d5b060ce3194c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Mon, 18 May 2020 16:04:00 +0300 Subject: [PATCH 33/43] Improve logging for Dispute status update jbo --- app/jobs/dispute_status_update_job.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/jobs/dispute_status_update_job.rb b/app/jobs/dispute_status_update_job.rb index 2a3f3445a..81c1fdeab 100644 --- a/app/jobs/dispute_status_update_job.rb +++ b/app/jobs/dispute_status_update_job.rb @@ -6,7 +6,7 @@ class DisputeStatusUpdateJob < Que::Job close_disputes activate_disputes - Rails.logger.info "DisputeStatusUpdateJob - All done. Closed #{@backlog['closed']} and " \ + logger.info "DisputeStatusUpdateJob - All done. Closed #{@backlog['closed']} and " \ "activated #{@backlog['activated']} disputes." show_failed_disputes unless @backlog['activate_fail'].empty? && @backlog['close_fail'].empty? @@ -14,7 +14,7 @@ class DisputeStatusUpdateJob < Que::Job def close_disputes disputes = Dispute.where(closed: nil).where('expires_at < ?', Time.zone.today).all - Rails.logger.info "DisputeStatusUpdateJob - Found #{disputes.count} closable disputes" + logger.info "DisputeStatusUpdateJob - Found #{disputes.count} closable disputes" disputes.each do |dispute| process_dispute(dispute, closing: true) end @@ -22,7 +22,7 @@ class DisputeStatusUpdateJob < Que::Job def activate_disputes disputes = Dispute.where(closed: nil, starts_at: Time.zone.today).all - Rails.logger.info "DisputeStatusUpdateJob - Found #{disputes.count} activatable disputes" + logger.info "DisputeStatusUpdateJob - Found #{disputes.count} activatable disputes" disputes.each do |dispute| process_dispute(dispute, closing: false) @@ -38,24 +38,28 @@ class DisputeStatusUpdateJob < Que::Job def create_backlog_entry(dispute:, intent:, successful:) if successful @backlog["#{intent}d"] += 1 - Rails.logger.info "DisputeStatusUpdateJob - #{intent}d dispute " \ + logger.info "DisputeStatusUpdateJob - #{intent}d dispute " \ " for '#{dispute.domain_name}'" else @backlog["#{intent}_fail"] << dispute.id - Rails.logger.info 'DisputeStatusUpdateJob - Failed to' \ + logger.info 'DisputeStatusUpdateJob - Failed to' \ "#{intent} dispute for '#{dispute.domain_name}'" end end def show_failed_disputes if @backlog['close_fail'].any? - Rails.logger.info('DisputeStatusUpdateJob - Failed to close disputes with Ids:' \ + logger.info('DisputeStatusUpdateJob - Failed to close disputes with Ids:' \ "#{@backlog['close_fail']}") end return unless @backlog['activate_fail'].any? - Rails.logger.info('DisputeStatusUpdateJob - Failed to activate disputes with Ids:' \ + logger.info('DisputeStatusUpdateJob - Failed to activate disputes with Ids:' \ "#{@backlog['activate_fail']}") end + + def logger + Logger.new(STDOUT) + end end From cb0051d4e0fc57e352269d12d4039b86f2735346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 19 May 2020 10:54:29 +0300 Subject: [PATCH 34/43] Alert admin if dispute created for unregistered domain --- app/controllers/admin/disputes_controller.rb | 5 +++- test/integration/admin_area/disputes_test.rb | 31 +++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index 450576aa3..ae187f86b 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -27,7 +27,10 @@ module Admin def create @dispute = Dispute.new(dispute_params) if @dispute.save - redirect_to admin_disputes_url, notice: 'Dispute was successfully created.' + notice = 'Dispute was successfully created' + notice += @dispute.domain ? '.' : ' for domain that is not registered.' + + redirect_to admin_disputes_url, notice: notice else render :new end diff --git a/test/integration/admin_area/disputes_test.rb b/test/integration/admin_area/disputes_test.rb index b829e3b49..81019bb66 100644 --- a/test/integration/admin_area/disputes_test.rb +++ b/test/integration/admin_area/disputes_test.rb @@ -15,22 +15,38 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase end def test_creates_new_dispute - assert_nil Dispute.active.find_by(domain_name: 'disputed.test') + assert_nil Dispute.active.find_by(domain_name: 'hospital.test') visit admin_disputes_path click_on 'New disputed domain' - fill_in 'Domain name', with: 'disputed.test' + fill_in 'Domain name', with: 'hospital.test' + fill_in 'Password', with: '1234' + fill_in 'Starts at', with: (Time.zone.today - 2.years).to_s + fill_in 'Comment', with: 'Sample comment' + click_on 'Save' + + assert_text 'Dispute was successfully created.' + assert_text 'hospital.test' + end + + def test_creates_new_dispute_for_unregistered_domain + assert_nil Dispute.active.find_by(domain_name: 'nonexistant.test') + + visit admin_disputes_path + click_on 'New disputed domain' + + fill_in 'Domain name', with: 'nonexistant.test' fill_in 'Password', with: '1234' fill_in 'Starts at', with: Time.zone.today.to_s fill_in 'Comment', with: 'Sample comment' click_on 'Save' - assert_text 'Dispute was successfully created.' - assert_text 'disputed.test' + assert_text 'Dispute was successfully created for domain that is not registered.' + assert_text 'nonexistant.test' end - def test_throws_error_if_starts_at_is_past + def test_throws_error_if_starts_at_is_in_future assert_nil Dispute.active.find_by(domain_name: 'disputed.test') visit admin_disputes_path @@ -38,12 +54,11 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase fill_in 'Domain name', with: 'disputed.test' fill_in 'Password', with: '1234' - fill_in 'Starts at', with: (Time.zone.today - 2.day).to_s + fill_in 'Starts at', with: (Time.zone.today + 2.day).to_s fill_in 'Comment', with: 'Sample comment' click_on 'Save' - assert_text 'Dispute was successfully created.' - assert_text 'disputed.test' + assert_text "Can not be greater than today's date" end def test_updates_dispute From 0998ada2fccea1638e41d0c2b2e3841af1cff0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 19 May 2020 12:25:04 +0300 Subject: [PATCH 35/43] Fix pagination/sorting for disputed domains --- app/controllers/admin/disputes_controller.rb | 6 +++--- app/views/admin/disputes/index.html.erb | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/admin/disputes_controller.rb b/app/controllers/admin/disputes_controller.rb index ae187f86b..8a8997f63 100644 --- a/app/controllers/admin/disputes_controller.rb +++ b/app/controllers/admin/disputes_controller.rb @@ -9,7 +9,7 @@ module Admin def index params[:q] ||= {} @disputes = sortable_dispute_query_for(Dispute.active.all, params[:q]) - @closed_disputes = sortable_dispute_query_for(Dispute.closed.all, params[:q]) + @closed_disputes = sortable_dispute_query_for(Dispute.closed.all, params[:q], closed: true) end # GET /admin/disputes/1 @@ -53,9 +53,9 @@ module Admin private - def sortable_dispute_query_for(disputes, query) + def sortable_dispute_query_for(disputes, query, closed: false) @q = disputes.order(:domain_name).search(query) - disputes = @q.result.page(params[:page]) + disputes = @q.result.page(closed ? params[:closed_page] : params[:page]) return disputes.per(params[:results_per_page]) if params[:results_per_page].present? disputes diff --git a/app/views/admin/disputes/index.html.erb b/app/views/admin/disputes/index.html.erb index c4bd094a9..e32ddb730 100644 --- a/app/views/admin/disputes/index.html.erb +++ b/app/views/admin/disputes/index.html.erb @@ -8,8 +8,8 @@
- <%= f.label :name %> - <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', placeholder: t(:name) %> + <%= f.label :domain_name %> + <%= f.search_field :domain_name_matches, value: params[:q][:domain_name_matches], class: 'form-control', placeholder: t(:name) %>
@@ -53,7 +53,7 @@ - <%= sort_link(@q, 'name') %> + <%= sort_link(@q, 'domain_name') %> <%= sort_link(@q, 'password') %> @@ -122,16 +122,16 @@ - <%= sort_link(@q, 'name') %> + <%= sort_link(@q, 'domain_name') %> - <%= sort_link(@q, 'Initiator') %> + <%= sort_link(@q, 'initiator') %> <%= sort_link(@q, 'starts_at') %> - <%= sort_link(@q, 'Expired/Closed At') %> + <%= sort_link(@q, 'closed') %> <%= sort_link(@q, 'comment') %> @@ -165,7 +165,7 @@
- <%= paginate @closed_disputes %> + <%= paginate @closed_disputes, param_name: :closed_page %>