From 3e67ff4d65a0395e17e2c1257d4f682037a348d9 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Tue, 15 Sep 2020 11:32:58 +0500 Subject: [PATCH 01/16] Add Omniauth-Tara gem/initializer --- Gemfile | 4 +++ Gemfile.lock | 60 +++++++++++++++++++++++++++++++-- config/application.yml.sample | 7 ++++ config/initializers/omniauth.rb | 45 +++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 config/initializers/omniauth.rb diff --git a/Gemfile b/Gemfile index accb4d3a2..15d5f779c 100644 --- a/Gemfile +++ b/Gemfile @@ -53,6 +53,10 @@ gem 'digidoc_client', github: 'tarmotalu/digidoc_client', ref: '1645e83a5a548addce383f75703b0275c5310c32' +# TARA +gem 'omniauth-rails_csrf_protection' +gem 'omniauth-tara', github: 'internetee/omniauth-tara' + gem 'epp', github: 'internetee/epp', branch: :master gem 'epp-xml', '1.1.0', github: 'internetee/epp-xml' diff --git a/Gemfile.lock b/Gemfile.lock index 3f9824cf1..574afc9df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,6 +52,15 @@ GIT logger nokogiri +GIT + remote: https://github.com/internetee/omniauth-tara.git + revision: cec845ec3794532144c4976104a07e206d759aa6 + specs: + omniauth-tara (0.3.0) + addressable (~> 2.5) + omniauth (~> 1.3) + openid_connect (~> 1.1) + GIT remote: https://github.com/tarmotalu/digidoc_client.git revision: 1645e83a5a548addce383f75703b0275c5310c32 @@ -126,6 +135,7 @@ GEM zeitwerk (~> 2.2, >= 2.2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) + aes_key_wrap (1.1.0) airbrake (11.0.0) airbrake-ruby (~> 5.0) airbrake-ruby (5.0.2) @@ -133,9 +143,11 @@ GEM akami (1.3.1) gyoku (>= 0.4.0) nokogiri + attr_required (1.0.1) autoprefixer-rails (10.0.0.2) execjs bcrypt (3.1.16) + bindata (2.4.8) bootsnap (1.4.8) msgpack (~> 1.0) bootstrap-sass (3.4.1) @@ -175,7 +187,7 @@ GEM data_migrate (6.3.0) rails (>= 5.0) database_cleaner (1.8.5) - devise (4.7.2) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -227,6 +239,7 @@ GEM temple (>= 0.8.0) tilt hashdiff (1.0.1) + hashie (4.1.0) hpricot (0.8.6) http-accept (1.7.0) http-cookie (1.0.3) @@ -247,6 +260,10 @@ GEM jquery-ui-rails (5.0.5) railties (>= 3.2.16) json (2.3.1) + json-jwt (1.13.0) + activesupport (>= 4.2) + aes_key_wrap + bindata kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -302,7 +319,23 @@ GEM nokogiri (1.10.10) mini_portile2 (~> 2.4.0) nori (2.6.0) + omniauth (1.9.1) + hashie (>= 3.4.6) + rack (>= 1.6.2, < 3) + omniauth-rails_csrf_protection (0.1.2) + actionpack (>= 4.2) + omniauth (>= 1.3.1) open4 (1.3.4) + openid_connect (1.2.0) + activemodel + attr_required (>= 1.0.0) + json-jwt (>= 1.5.0) + rack-oauth2 (>= 1.6.1) + swd (>= 1.0.0) + tzinfo + validate_email + validate_url + webfinger (>= 1.0.1) orm_adapter (0.5.0) paper_trail (10.3.1) activerecord (>= 4.2) @@ -326,6 +359,12 @@ GEM rack (2.2.3) rack-accept (0.4.5) rack (>= 0.4) + rack-oauth2 (1.16.0) + activesupport + attr_required + httpclient + json-jwt (>= 1.11.0) + rack (>= 2.1.0) rack-protection (2.1.0) rack rack-test (1.1.0) @@ -366,7 +405,7 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) rbtree3 (0.6.0) - regexp_parser (1.7.1) + regexp_parser (1.8.0) request_store (1.5.0) rack (>= 1.4) responders (3.0.1) @@ -425,11 +464,15 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + swd (1.2.0) + activesupport (>= 3) + attr_required (>= 0.0.5) + httpclient (>= 2.4) temple (0.8.2) thor (0.20.3) thread_safe (0.3.6) tilt (2.0.10) - truemail (1.9.0) + truemail (1.9.1) simpleidn (~> 0.1.1) tzinfo (1.2.7) thread_safe (~> 0.1) @@ -439,6 +482,12 @@ GEM unf_ext unf_ext (0.0.7.7) unicode_utils (1.4.0) + validate_email (0.1.6) + activemodel (>= 3.0) + mail (>= 2.2.5) + validate_url (1.0.13) + activemodel (>= 3.0.0) + public_suffix validates_email_format_of (1.6.3) i18n warden (1.2.9) @@ -451,6 +500,9 @@ GEM nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (>= 3.0, < 4.0) + webfinger (1.1.0) + activesupport + httpclient (>= 2.4) webmock (3.9.1) addressable (>= 2.3.6) crack (>= 0.3.2) @@ -503,6 +555,8 @@ DEPENDENCIES minitest (~> 5.14) money-rails nokogiri + omniauth-rails_csrf_protection + omniauth-tara! paper_trail (~> 10.3) pdfkit pg (= 1.2.2) diff --git a/config/application.yml.sample b/config/application.yml.sample index 72b55e2ea..cbe32e5db 100644 --- a/config/application.yml.sample +++ b/config/application.yml.sample @@ -156,6 +156,13 @@ lhv_dev_mode: 'false' epp_session_timeout_seconds: '300' contact_archivation_log_file_dir: +tara_host: 'tara-test.ria.ee' +tara_issuer: 'https://tara-test.ria.ee' +tara_identifier: 'identifier' +tara_secret: 'secret' +tara_redirect_uri: 'redirect_url' +tara_keys: "{\"kty\":\"RSA\",\"kid\":\"de6cc4\",\"n\":\"jWwAjT_03ypme9ZWeSe7c-jY26NO50Wo5I1LBnPW2JLc0dPMj8v7y4ehiRpClYNTaSWcLd4DJmlKXDXXudEUWwXa7TtjBFJfzlZ-1u0tDvJ-H9zv9MzO7UhUFytztUEMTrtStdhGbzkzdEZZCgFYeo2i33eXxzIR1nGvI05d9Y-e_LHnNE2ZKTa89BC7ZiCXq5nfAaCgQna_knh4kFAX-KgiPRAtsiDHcAWKcBY3qUVcb-5XAX8p668MlGLukzsh5tFkQCbJVyNtmlbIHdbGvVHPb8C0H3oLYciv1Fjy_tS1lO7OT_cb3GVp6Ql-CG0uED_8pkpVtfsGRviub4_ElQ\",\"e\":\"AQAB\"}" + # Since the keys for staging are absent from the repo, we need to supply them separate for testing. test: payments_seb_bank_certificate: 'test/fixtures/files/seb_bank_cert.pem' diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb new file mode 100644 index 000000000..0e0ab9142 --- /dev/null +++ b/config/initializers/omniauth.rb @@ -0,0 +1,45 @@ +OpenIDConnect.logger = Rails.logger +OpenIDConnect.debug! + +OpenIDConnect.http_config do |config| + config.proxy = AuctionCenter::Application.config.customization.dig(:tara, :proxy) +end + +OmniAuth.config.logger = Rails.logger +# Block GET requests to avoid exposing self to CVE-2015-9284 +OmniAuth.config.allowed_request_methods = [:post] + +signing_keys = ENV['tara_keys'] +issuer = ENV['tara_issuer'] +host = ENV['tara_host'] +identifier = ENV['tara_identifier'] +secret = ENV['tara_secret'] +redirect_uri = ENV['tara_redirect_uri'] + +Rails.application.config.middleware.use OmniAuth::Builder do + provider "tara", { + name: 'tara', + scope: ['openid'], + state: Proc.new{ SecureRandom.hex(10) }, + client_signing_alg: :RS256, + client_jwk_signing_key: signing_keys, + send_scope_to_token_endpoint: false, + send_nonce: true, + issuer: issuer, + + client_options: { + scheme: 'https', + host: host, + + authorization_endpoint: '/oidc/authorize', + token_endpoint: '/oidc/token', + userinfo_endpoint: nil, # Not implemented + jwks_uri: '/oidc/jwks', + + # Auction + identifier: identifier, + secret: secret, + redirect_uri: redirect_uri, + }, + } +end From e93daa21d573558b48631eec832bf340e4f87b02 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Tue, 15 Sep 2020 13:02:05 +0500 Subject: [PATCH 02/16] Add Tara field to users, add routes & controller --- app/controllers/registrar/tara_controller.rb | 64 +++++++++++++++++++ app/errors/tampering_detected.rb | 3 + app/models/user.rb | 33 ++++++++++ config/locales/en.yml | 2 + config/locales/tara.en.yml | 14 ++++ config/locales/tara.et.yml | 14 ++++ config/routes.rb | 5 ++ ...00915073245_add_omniauth_fields_to_user.rb | 10 +++ db/structure.sql | 13 +++- 9 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 app/controllers/registrar/tara_controller.rb create mode 100644 app/errors/tampering_detected.rb create mode 100644 config/locales/tara.en.yml create mode 100644 config/locales/tara.et.yml create mode 100644 db/migrate/20200915073245_add_omniauth_fields_to_user.rb diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb new file mode 100644 index 000000000..ce986c798 --- /dev/null +++ b/app/controllers/registrar/tara_controller.rb @@ -0,0 +1,64 @@ +require 'tampering_detected' + +class TaraController < ApplicationController + rescue_from Errors::TamperingDetected do + redirect_to root_url, alert: t('auth.tara.tampering') + end + + def callback + session[:omniauth_hash] = user_hash + + @user = User.from_omniauth(user_hash) + + return unless @user.persisted? + + sign_in(User, @user) + redirect_to user_path(@user.uuid), notice: t('devise.sessions.signed_in') + end + + # rubocop:disable Metrics/MethodLength + def create + @user = User.new(create_params) + check_for_tampering + create_password + + respond_to do |format| + if @user.save + format.html do + sign_in(User, @user) + redirect_to user_path(@user.uuid), notice: t(:created) + end + else + format.html { render :callback } + end + end + end + # rubocop:enable Metrics/MethodLength + + def cancel + redirect_to root_path, notice: t(:sign_in_cancelled) + end + + private + + def create_params + params.require(:user) + .permit(:email, :identity_code, :country_code, :given_names, :surname, + :accepts_terms_and_conditions, :locale, :uid, :provider) + end + + def check_for_tampering + return unless @user.tampered_with?(session[:omniauth_hash]) + + session.delete(:omniauth_hash) + raise Errors::TamperingDetected + end + + def create_password + @user.password = Devise.friendly_token[0..20] + end + + def user_hash + request.env['omniauth.auth'] + end +end diff --git a/app/errors/tampering_detected.rb b/app/errors/tampering_detected.rb new file mode 100644 index 000000000..1cf72ba58 --- /dev/null +++ b/app/errors/tampering_detected.rb @@ -0,0 +1,3 @@ +module Errors + class TamperingDetected < ActionController::BadRequest; end +end diff --git a/app/models/user.rb b/app/models/user.rb index 6b16bd508..2234a3154 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,9 @@ class User < ApplicationRecord include Versions # version/user_version.rb + ESTONIAN_COUNTRY_CODE = 'EE'.freeze + TARA_PROVIDER = 'tara'.freeze + has_many :actions, dependent: :restrict_with_exception attr_accessor :phone @@ -11,4 +14,34 @@ class User < ApplicationRecord "#{self.id}-#{self.class}: #{self.username}" end + # rubocop:disable Metrics/AbcSize + def tampered_with?(omniauth_hash) + uid_from_hash = omniauth_hash['uid'] + provider_from_hash = omniauth_hash['provider'] + + begin + uid != uid_from_hash || + provider != provider_from_hash || + country_code != uid_from_hash.slice(0..1) || + identity_code != uid_from_hash.slice(2..-1) || + given_names != omniauth_hash.dig('info', 'first_name') || + surname != omniauth_hash.dig('info', 'last_name') + end + end + # rubocop:enable Metrics/AbcSize + + def self.from_omniauth(omniauth_hash) + uid = omniauth_hash['uid'] + provider = omniauth_hash['provider'] + + User.find_or_initialize_by(provider: provider, uid: uid) do |user| + user.given_names = omniauth_hash.dig('info', 'first_name') + user.surname = omniauth_hash.dig('info', 'last_name') + if provider == TARA_PROVIDER + user.country_code = uid.slice(0..1) + user.identity_code = uid.slice(2..-1) + end + end + end + end diff --git a/config/locales/en.yml b/config/locales/en.yml index 9c5b98a1b..398a423f0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -295,6 +295,8 @@ en: authentication_error: 'Authentication error' + sign_in_cancelled: "Sign in cancelled" + transfer_requested: 'Transfer requested.' message_was_not_found: 'Message was not found' only_one_parameter_allowed: 'Only one parameter allowed: %{param_1} or %{param_2}' diff --git a/config/locales/tara.en.yml b/config/locales/tara.en.yml new file mode 100644 index 000000000..ff37e8ff7 --- /dev/null +++ b/config/locales/tara.en.yml @@ -0,0 +1,14 @@ +en: + auth: + tara: + tampering: "Tampering detected. Sign in cancelled." + + callback: + title: "Create a user" + errors: "prohibited this user from being saved" + + form: + contact_data: "Contact Data" + data_from_identity_document: "Data from identity document" + new_password: "New password" + sign_up: "Sign up" diff --git a/config/locales/tara.et.yml b/config/locales/tara.et.yml new file mode 100644 index 000000000..a4ccaf6dd --- /dev/null +++ b/config/locales/tara.et.yml @@ -0,0 +1,14 @@ +et: + auth: + tara: + tampering: "Avastatud urkimine. Sisselogimine tühistatud." + + callback: + title: "Loo kasutaja" + errors: "seda kasutajat ei saa salvestada" + + form: + contact_data: "Kontaktandmed" + data_from_identity_document: "Andmed elektroonselt isikutunnistuselt" + new_password: "Uus salasõna" + sign_up: "Registreeru" diff --git a/config/routes.rb b/config/routes.rb index 223cf3171..73d482cf0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,6 +85,11 @@ Rails.application.routes.draw do post 'id' => 'sessions#id_card', as: :id_card_sign_in post 'mid' => 'sessions#mid' + + match '/tara/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback + match '/tara/cancel', via: %i[get post delete], to: 'tara#cancel', + as: :tara_cancel + match '/tara/create', via: [:post], to: 'tara#create', as: :tara_create end resources :invoices, except: %i[new create edit update destroy] do diff --git a/db/migrate/20200915073245_add_omniauth_fields_to_user.rb b/db/migrate/20200915073245_add_omniauth_fields_to_user.rb new file mode 100644 index 000000000..8826559e3 --- /dev/null +++ b/db/migrate/20200915073245_add_omniauth_fields_to_user.rb @@ -0,0 +1,10 @@ +class AddOmniauthFieldsToUser < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + + def change + add_column :users, :provider, :string + add_column :users, :uid, :string + add_index :users, [:provider, :uid], algorithm: :concurrently, + unique: true + end +end diff --git a/db/structure.sql b/db/structure.sql index 6a30fbc84..e4e9b8c2f 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2437,7 +2437,9 @@ CREATE TABLE public.users ( remember_created_at timestamp without time zone, failed_attempts integer DEFAULT 0 NOT NULL, locked_at timestamp without time zone, - legacy_id integer + legacy_id integer, + provider character varying, + uid character varying ); @@ -4190,6 +4192,12 @@ CREATE UNIQUE INDEX index_settings_on_thing_type_and_thing_id_and_var ON public. CREATE INDEX index_users_on_identity_code ON public.users USING btree (identity_code); +-- +-- Name: index_users_on_provider_and_uid; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_users_on_provider_and_uid ON public.users USING btree (provider, uid); + -- -- Name: index_users_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace: @@ -4906,5 +4914,6 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200902131603'), ('20200908131554'), ('20200910085157'), -('20200910102028'); +('20200910102028'), +('20200915073245'); From 8ff92548bf3a696519af3cde7434d6e655c1a492 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 23 Sep 2020 12:31:37 +0500 Subject: [PATCH 03/16] Set cllback routes according to Tara inquiry --- config/routes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 73d482cf0..b02c757fd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,10 +86,10 @@ Rails.application.routes.draw do post 'mid' => 'sessions#mid' - match '/tara/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback - match '/tara/cancel', via: %i[get post delete], to: 'tara#cancel', + match '/open_id/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback + match '/open_id/cancel', via: %i[get post delete], to: 'tara#cancel', as: :tara_cancel - match '/tara/create', via: [:post], to: 'tara#create', as: :tara_create + match '/open_id/create', via: [:post], to: 'tara#create', as: :tara_create end resources :invoices, except: %i[new create edit update destroy] do From ffeb1d4baa6627874554c469ba1803f223415b1d Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 23 Sep 2020 13:01:33 +0500 Subject: [PATCH 04/16] Prepare view & controller --- app/controllers/registrar/tara_controller.rb | 97 +- app/models/user.rb | 23 +- app/views/registrar/sessions/new.html.erb | 14 +- app/views/registrar/tara/callback.html.erb | 0 config/locales/registrar/sessions.en.yml | 4 + db/structure.sql | 2862 ++++++++++++++++-- 6 files changed, 2612 insertions(+), 388 deletions(-) create mode 100644 app/views/registrar/tara/callback.html.erb diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb index ce986c798..0d0805e2d 100644 --- a/app/controllers/registrar/tara_controller.rb +++ b/app/controllers/registrar/tara_controller.rb @@ -1,64 +1,71 @@ require 'tampering_detected' -class TaraController < ApplicationController - rescue_from Errors::TamperingDetected do - redirect_to root_url, alert: t('auth.tara.tampering') - end +class Registrar + class TaraController < ApplicationController + rescue_from Errors::TamperingDetected do + redirect_to root_url, alert: t('auth.tara.tampering') + end - def callback - session[:omniauth_hash] = user_hash + def callback + session[:omniauth_hash] = user_hash + @user = User.from_omniauth(user_hash) - @user = User.from_omniauth(user_hash) + return unless @user.persisted? - return unless @user.persisted? + sign_in(User, @user) + redirect_to user_path(@user.uuid), notice: t('devise.sessions.signed_in') + end - sign_in(User, @user) - redirect_to user_path(@user.uuid), notice: t('devise.sessions.signed_in') - end + # rubocop:disable Metrics/MethodLength + def create + tara_logger.info create_params + @user = User.new(create_params) + check_for_tampering + create_password - # rubocop:disable Metrics/MethodLength - def create - @user = User.new(create_params) - check_for_tampering - create_password - - respond_to do |format| - if @user.save - format.html do - sign_in(User, @user) - redirect_to user_path(@user.uuid), notice: t(:created) + respond_to do |format| + if @user.save + format.html do + sign_in(User, @user) + redirect_to user_path(@user.uuid), notice: t(:created) + end + else + format.html { render :callback } end - else - format.html { render :callback } end end - end - # rubocop:enable Metrics/MethodLength + # rubocop:enable Metrics/MethodLength - def cancel - redirect_to root_path, notice: t(:sign_in_cancelled) - end + def cancel + redirect_to root_path, notice: t(:sign_in_cancelled) + end - private + private - def create_params - params.require(:user) - .permit(:email, :identity_code, :country_code, :given_names, :surname, - :accepts_terms_and_conditions, :locale, :uid, :provider) - end + def create_params + params.require(:user) + .permit(:email, :identity_code, :country_code, :given_names, :surname, + :accepts_terms_and_conditions, :locale, :uid, :provider) + end - def check_for_tampering - return unless @user.tampered_with?(session[:omniauth_hash]) + def check_for_tampering + return unless @user.tampered_with?(session[:omniauth_hash]) - session.delete(:omniauth_hash) - raise Errors::TamperingDetected - end + session.delete(:omniauth_hash) + raise Errors::TamperingDetected + end - def create_password - @user.password = Devise.friendly_token[0..20] - end + def create_password + @user.password = Devise.friendly_token[0..20] + end - def user_hash - request.env['omniauth.auth'] + def user_hash + tara_logger.info request.env + request.env['omniauth.auth'] + end + + def tara_logger + @tara_logger ||= Logger.new(Rails.root.join('log', 'tara_auth2.log')) + end end end diff --git a/app/models/user.rb b/app/models/user.rb index 2234a3154..d3221b137 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,17 +16,18 @@ class User < ApplicationRecord # rubocop:disable Metrics/AbcSize def tampered_with?(omniauth_hash) - uid_from_hash = omniauth_hash['uid'] - provider_from_hash = omniauth_hash['provider'] - - begin - uid != uid_from_hash || - provider != provider_from_hash || - country_code != uid_from_hash.slice(0..1) || - identity_code != uid_from_hash.slice(2..-1) || - given_names != omniauth_hash.dig('info', 'first_name') || - surname != omniauth_hash.dig('info', 'last_name') - end + # uid_from_hash = omniauth_hash['uid'] + # provider_from_hash = omniauth_hash['provider'] + # + # begin + # uid != uid_from_hash || + # provider != provider_from_hash || + # country_code != uid_from_hash.slice(0..1) || + # identity_code != uid_from_hash.slice(2..-1) || + # given_names != omniauth_hash.dig('info', 'first_name') || + # surname != omniauth_hash.dig('info', 'last_name') + # end + false end # rubocop:enable Metrics/AbcSize diff --git a/app/views/registrar/sessions/new.html.erb b/app/views/registrar/sessions/new.html.erb index 8056b07c8..7b90cf3be 100644 --- a/app/views/registrar/sessions/new.html.erb +++ b/app/views/registrar/sessions/new.html.erb @@ -19,12 +19,16 @@
- <%= link_to '/registrar/login/mid', id: 'login-with-mobile-id-btn' do %> - <%= image_tag 'mid.gif' %> - <% end %> + <%#= link_to '/registrar/login/mid', id: 'login-with-mobile-id-btn' do %> + <%#= image_tag 'mid.gif' %> + <%# end %> - <%= link_to registrar_id_card_sign_in_path, method: :post do %> + <%#= link_to registrar_id_card_sign_in_path, method: :post do %> + <%#= image_tag 'id_card.gif' %> + <%# end %> + + <%= link_to "/auth/tara", method: :post, class: "ui button big primary" do %> <%= image_tag 'id_card.gif' %> <% end %> - \ No newline at end of file + diff --git a/app/views/registrar/tara/callback.html.erb b/app/views/registrar/tara/callback.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/locales/registrar/sessions.en.yml b/config/locales/registrar/sessions.en.yml index f74f74bc9..4854edccc 100644 --- a/config/locales/registrar/sessions.en.yml +++ b/config/locales/registrar/sessions.en.yml @@ -7,3 +7,7 @@ en: login_mid: header: Log in with mobile-id submit_btn: Login + tara: + callback: + header_html: "Eesti Interneti SA
Registrar Portal" + submit_btn: Login diff --git a/db/structure.sql b/db/structure.sql index e4e9b8c2f..5ea01f91f 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; -- @@ -205,12 +196,1398 @@ CREATE FUNCTION public.generate_zonefile(i_origin character varying) RETURNS tex $_$; +-- +-- Name: process_account_activity_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_account_activity_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.account_activities + (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.account_activities + (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.account_activities + (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 +$$; + + +-- +-- Name: process_account_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_account_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.accounts + (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.accounts + (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.accounts + (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 +$$; + + +-- +-- Name: process_action_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_action_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.actions + (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.actions + (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.actions + (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 +$$; + + +-- +-- Name: process_bank_statement_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_bank_statement_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.bank_statements + (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.bank_statements + (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.bank_statements + (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 +$$; + + +-- +-- Name: process_bank_transaction_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_bank_transaction_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.bank_transactions + (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.bank_transactions + (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.bank_transactions + (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 +$$; + + +-- +-- Name: process_blocked_domain_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_blocked_domain_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.blocked_domains + (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.blocked_domains + (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.blocked_domains + (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 +$$; + + +-- +-- Name: process_certificate_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_certificate_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.certificates + (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.certificates + (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.certificates + (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 +$$; + + +-- +-- 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 +$$; + + +-- +-- Name: process_dnskey_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_dnskey_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.dnskeys + (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.dnskeys + (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.dnskeys + (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 +$$; + + +-- +-- Name: process_domain_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_domain_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.domains + (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.domains + (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.domains + (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 +$$; + + +-- +-- Name: process_domain_contact_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_domain_contact_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.domain_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.domain_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.domain_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 +$$; + + +-- +-- Name: process_invoice_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_invoice_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.invoices + (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.invoices + (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.invoices + (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 +$$; + + +-- +-- Name: process_invoice_item_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_invoice_item_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.invoice_items + (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.invoice_items + (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.invoice_items + (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 +$$; + + +-- +-- Name: process_nameserver_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_nameserver_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.nameservers + (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.nameservers + (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.nameservers + (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 +$$; + + +-- +-- Name: process_notification_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_notification_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.notifications + (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.notifications + (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.notifications + (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 +$$; + + +-- +-- Name: process_payment_order_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_payment_order_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.payment_orders + (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.payment_orders + (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.payment_orders + (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 +$$; + + +-- +-- Name: process_registrant_verification_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_registrant_verification_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.registrant_verifications + (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.registrant_verifications + (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.registrant_verifications + (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 +$$; + + +-- +-- Name: process_registrar_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_registrar_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.registrars + (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.registrars + (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.registrars + (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 +$$; + + +-- +-- Name: process_reserved_domain_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_reserved_domain_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.reserved_domains + (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.reserved_domains + (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.reserved_domains + (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 +$$; + + +-- +-- Name: process_setting_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_setting_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.settings + (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.settings + (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.settings + (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 +$$; + + +-- +-- Name: process_user_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_user_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.users + (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.users + (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.users + (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 +$$; + + +-- +-- Name: process_white_ip_audit(); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.process_white_ip_audit() RETURNS trigger + LANGUAGE plpgsql + AS $$ + BEGIN + IF (TG_OP = 'INSERT') THEN + INSERT INTO audit.white_ips + (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.white_ips + (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.white_ips + (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: account_activities; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.account_activities ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT account_activities_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: account_activities_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.account_activities_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: account_activities_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.account_activities_id_seq OWNED BY audit.account_activities.id; + + +-- +-- Name: accounts; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.accounts ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT accounts_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: accounts_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.accounts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.accounts_id_seq OWNED BY audit.accounts.id; + + +-- +-- Name: actions; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.actions ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT actions_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: actions_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.actions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: actions_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.actions_id_seq OWNED BY audit.actions.id; + + +-- +-- Name: bank_statements; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.bank_statements ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT bank_statements_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: bank_statements_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.bank_statements_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bank_statements_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.bank_statements_id_seq OWNED BY audit.bank_statements.id; + + +-- +-- Name: bank_transactions; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.bank_transactions ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT bank_transactions_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: bank_transactions_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.bank_transactions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bank_transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.bank_transactions_id_seq OWNED BY audit.bank_transactions.id; + + +-- +-- Name: blocked_domains; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.blocked_domains ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT blocked_domains_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: blocked_domains_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.blocked_domains_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: blocked_domains_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.blocked_domains_id_seq OWNED BY audit.blocked_domains.id; + + +-- +-- Name: certificates; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.certificates ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT certificates_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: certificates_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.certificates_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: certificates_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.certificates_id_seq OWNED BY audit.certificates.id; + + +-- +-- 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: dnskeys; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.dnskeys ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT dnskeys_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: dnskeys_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.dnskeys_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: dnskeys_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.dnskeys_id_seq OWNED BY audit.dnskeys.id; + + +-- +-- Name: domain_contacts; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.domain_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 domain_contacts_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: domain_contacts_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.domain_contacts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: domain_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.domain_contacts_id_seq OWNED BY audit.domain_contacts.id; + + +-- +-- Name: domains; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.domains ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT domains_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: domains_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.domains_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: domains_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.domains_id_seq OWNED BY audit.domains.id; + + +-- +-- Name: invoice_items; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.invoice_items ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT invoice_items_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: invoice_items_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.invoice_items_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: invoice_items_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.invoice_items_id_seq OWNED BY audit.invoice_items.id; + + +-- +-- Name: invoices; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.invoices ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT invoices_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: invoices_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.invoices_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: invoices_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.invoices_id_seq OWNED BY audit.invoices.id; + + +-- +-- Name: nameservers; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.nameservers ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT nameservers_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: nameservers_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.nameservers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: nameservers_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.nameservers_id_seq OWNED BY audit.nameservers.id; + + +-- +-- Name: notifications; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.notifications ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT notifications_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: notifications_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.notifications_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.notifications_id_seq OWNED BY audit.notifications.id; + + +-- +-- Name: payment_orders; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.payment_orders ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT payment_orders_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: payment_orders_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.payment_orders_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: payment_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.payment_orders_id_seq OWNED BY audit.payment_orders.id; + + +-- +-- Name: registrant_verifications; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.registrant_verifications ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT registrant_verifications_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: registrant_verifications_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.registrant_verifications_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: registrant_verifications_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.registrant_verifications_id_seq OWNED BY audit.registrant_verifications.id; + + +-- +-- Name: registrars; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.registrars ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT registrars_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: registrars_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.registrars_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: registrars_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.registrars_id_seq OWNED BY audit.registrars.id; + + +-- +-- Name: reserved_domains; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.reserved_domains ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT reserved_domains_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: reserved_domains_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.reserved_domains_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: reserved_domains_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.reserved_domains_id_seq OWNED BY audit.reserved_domains.id; + + +-- +-- Name: settings; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.settings ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT settings_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: settings_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.settings_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: settings_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.settings_id_seq OWNED BY audit.settings.id; + + +-- +-- Name: users; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.users ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT users_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: users_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.users_id_seq OWNED BY audit.users.id; + + +-- +-- Name: white_ips; Type: TABLE; Schema: audit; Owner: - +-- + +CREATE TABLE audit.white_ips ( + id integer NOT NULL, + object_id bigint, + action text NOT NULL, + recorded_at timestamp without time zone, + old_value jsonb, + new_value jsonb, + CONSTRAINT white_ips_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) +); + + +-- +-- Name: white_ips_id_seq; Type: SEQUENCE; Schema: audit; Owner: - +-- + +CREATE SEQUENCE audit.white_ips_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: white_ips_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - +-- + +ALTER SEQUENCE audit.white_ips_id_seq OWNED BY audit.white_ips.id; + + +-- +-- Name: account_activities; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.account_activities ( @@ -250,7 +1627,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 ( @@ -286,7 +1663,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 ( @@ -318,7 +1695,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 ( @@ -330,7 +1707,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 ( @@ -364,7 +1741,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 ( @@ -399,7 +1776,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 ( @@ -443,7 +1820,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 ( @@ -476,7 +1853,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 ( @@ -515,7 +1892,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 ( @@ -573,7 +1950,7 @@ ALTER SEQUENCE public.contacts_id_seq OWNED BY public.contacts.id; -- --- Name: data_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: data_migrations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.data_migrations ( @@ -582,7 +1959,7 @@ CREATE TABLE public.data_migrations ( -- --- Name: directos; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: directos; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.directos ( @@ -617,7 +1994,7 @@ ALTER SEQUENCE public.directos_id_seq OWNED BY public.directos.id; -- --- Name: disputes; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: disputes; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.disputes ( @@ -654,7 +2031,7 @@ ALTER SEQUENCE public.disputes_id_seq OWNED BY public.disputes.id; -- --- Name: dnskeys; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: dnskeys; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.dnskeys ( @@ -695,7 +2072,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 ( @@ -733,7 +2110,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 ( @@ -770,7 +2147,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 ( @@ -805,7 +2182,8 @@ CREATE TABLE public.domains ( uuid uuid DEFAULT public.gen_random_uuid() NOT NULL, locked_by_registrant_at timestamp without time zone, force_delete_start timestamp without time zone, - force_delete_data public.hstore + force_delete_data public.hstore, + children jsonb ); @@ -829,7 +2207,7 @@ ALTER SEQUENCE public.domains_id_seq OWNED BY public.domains.id; -- --- Name: email_address_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: email_address_verifications; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.email_address_verifications ( @@ -861,7 +2239,7 @@ ALTER SEQUENCE public.email_address_verifications_id_seq OWNED BY public.email_a -- --- Name: email_addresses_validations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: email_addresses_validations; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.email_addresses_validations ( @@ -891,7 +2269,7 @@ ALTER SEQUENCE public.email_addresses_validations_id_seq OWNED BY public.email_a -- --- Name: email_addresses_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: email_addresses_verifications; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.email_addresses_verifications ( @@ -921,7 +2299,7 @@ ALTER SEQUENCE public.email_addresses_verifications_id_seq OWNED BY public.email -- --- Name: epp_sessions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: epp_sessions; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.epp_sessions ( @@ -953,7 +2331,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 ( @@ -991,7 +2369,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 ( @@ -1062,7 +2440,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 ( @@ -1097,7 +2475,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 ( @@ -1135,7 +2513,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 ( @@ -1173,7 +2551,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 ( @@ -1211,7 +2589,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 ( @@ -1249,7 +2627,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 ( @@ -1287,7 +2665,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 ( @@ -1325,7 +2703,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 ( @@ -1363,7 +2741,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 ( @@ -1402,7 +2780,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 ( @@ -1440,7 +2818,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 ( @@ -1478,7 +2856,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 ( @@ -1516,7 +2894,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 ( @@ -1554,7 +2932,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 ( @@ -1592,7 +2970,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 ( @@ -1630,7 +3008,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 ( @@ -1668,7 +3046,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 ( @@ -1781,7 +3159,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 ( @@ -1819,7 +3197,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 ( @@ -1857,7 +3235,7 @@ ALTER SEQUENCE public.log_reserved_domains_id_seq OWNED BY public.log_reserved_d -- --- Name: log_setting_entries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_setting_entries; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_setting_entries ( @@ -1895,7 +3273,7 @@ ALTER SEQUENCE public.log_setting_entries_id_seq OWNED BY public.log_setting_ent -- --- Name: log_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: log_settings; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.log_settings ( @@ -1933,7 +3311,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 ( @@ -1971,7 +3349,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 ( @@ -2009,7 +3387,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 ( @@ -2047,7 +3425,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 ( @@ -2085,7 +3463,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 ( @@ -2122,7 +3500,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 ( @@ -2130,13 +3508,13 @@ CREATE TABLE public.prices ( price_cents integer NOT NULL, valid_from timestamp without time zone, valid_to timestamp without time zone, - updator_str character varying, - creator_str character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, duration interval, operation_category character varying, - zone_id integer NOT NULL + zone_id integer NOT NULL, + updator_str character varying, + creator_str character varying ); @@ -2160,7 +3538,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 ( @@ -2202,7 +3580,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 ( @@ -2238,7 +3616,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 ( @@ -2293,7 +3671,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 ( @@ -2328,7 +3706,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 ( @@ -2337,7 +3715,7 @@ CREATE TABLE public.schema_migrations ( -- --- Name: setting_entries; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: setting_entries; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.setting_entries ( @@ -2373,7 +3751,7 @@ ALTER SEQUENCE public.setting_entries_id_seq OWNED BY public.setting_entries.id; -- --- Name: settings; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- Name: settings; Type: TABLE; Schema: public; Owner: - -- CREATE TABLE public.settings ( @@ -2409,7 +3787,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 ( @@ -2463,7 +3841,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 ( @@ -2498,7 +3876,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 ( @@ -2534,7 +3912,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 ( @@ -2569,7 +3947,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 ( @@ -2612,266 +3990,420 @@ ALTER SEQUENCE public.zones_id_seq OWNED BY public.zones.id; -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: account_activities id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.account_activities ALTER COLUMN id SET DEFAULT nextval('audit.account_activities_id_seq'::regclass); + + +-- +-- Name: accounts id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.accounts ALTER COLUMN id SET DEFAULT nextval('audit.accounts_id_seq'::regclass); + + +-- +-- Name: actions id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.actions ALTER COLUMN id SET DEFAULT nextval('audit.actions_id_seq'::regclass); + + +-- +-- Name: bank_statements id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.bank_statements ALTER COLUMN id SET DEFAULT nextval('audit.bank_statements_id_seq'::regclass); + + +-- +-- Name: bank_transactions id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.bank_transactions ALTER COLUMN id SET DEFAULT nextval('audit.bank_transactions_id_seq'::regclass); + + +-- +-- Name: blocked_domains id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.blocked_domains ALTER COLUMN id SET DEFAULT nextval('audit.blocked_domains_id_seq'::regclass); + + +-- +-- Name: certificates id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.certificates ALTER COLUMN id SET DEFAULT nextval('audit.certificates_id_seq'::regclass); + + +-- +-- 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: dnskeys id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.dnskeys ALTER COLUMN id SET DEFAULT nextval('audit.dnskeys_id_seq'::regclass); + + +-- +-- Name: domain_contacts id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.domain_contacts ALTER COLUMN id SET DEFAULT nextval('audit.domain_contacts_id_seq'::regclass); + + +-- +-- Name: domains id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.domains ALTER COLUMN id SET DEFAULT nextval('audit.domains_id_seq'::regclass); + + +-- +-- Name: invoice_items id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.invoice_items ALTER COLUMN id SET DEFAULT nextval('audit.invoice_items_id_seq'::regclass); + + +-- +-- Name: invoices id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.invoices ALTER COLUMN id SET DEFAULT nextval('audit.invoices_id_seq'::regclass); + + +-- +-- Name: nameservers id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.nameservers ALTER COLUMN id SET DEFAULT nextval('audit.nameservers_id_seq'::regclass); + + +-- +-- Name: notifications id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.notifications ALTER COLUMN id SET DEFAULT nextval('audit.notifications_id_seq'::regclass); + + +-- +-- Name: payment_orders id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.payment_orders ALTER COLUMN id SET DEFAULT nextval('audit.payment_orders_id_seq'::regclass); + + +-- +-- Name: registrant_verifications id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.registrant_verifications ALTER COLUMN id SET DEFAULT nextval('audit.registrant_verifications_id_seq'::regclass); + + +-- +-- Name: registrars id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.registrars ALTER COLUMN id SET DEFAULT nextval('audit.registrars_id_seq'::regclass); + + +-- +-- Name: reserved_domains id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.reserved_domains ALTER COLUMN id SET DEFAULT nextval('audit.reserved_domains_id_seq'::regclass); + + +-- +-- Name: settings id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.settings ALTER COLUMN id SET DEFAULT nextval('audit.settings_id_seq'::regclass); + + +-- +-- Name: users id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.users ALTER COLUMN id SET DEFAULT nextval('audit.users_id_seq'::regclass); + + +-- +-- Name: white_ips id; Type: DEFAULT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.white_ips ALTER COLUMN id SET DEFAULT nextval('audit.white_ips_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: id; Type: DEFAULT; Schema: public; Owner: - +-- 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: email_address_verifications id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_address_verifications ALTER COLUMN id SET DEFAULT nextval('public.email_address_verifications_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: email_addresses_validations id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_addresses_validations ALTER COLUMN id SET DEFAULT nextval('public.email_addresses_validations_id_seq'::regclass); -- --- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- Name: email_addresses_verifications id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_addresses_verifications ALTER COLUMN id SET DEFAULT nextval('public.email_addresses_verifications_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); @@ -2892,154 +4424,330 @@ ALTER TABLE ONLY public.log_registrant_verifications ALTER COLUMN id SET DEFAULT -- --- 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_setting_entries id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_setting_entries ALTER COLUMN id SET DEFAULT nextval('public.log_setting_entries_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: setting_entries id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.setting_entries ALTER COLUMN id SET DEFAULT nextval('public.setting_entries_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: account_activities account_activities_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.account_activities + ADD CONSTRAINT account_activities_pkey PRIMARY KEY (id); + + +-- +-- Name: accounts accounts_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.accounts + ADD CONSTRAINT accounts_pkey PRIMARY KEY (id); + + +-- +-- Name: actions actions_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.actions + ADD CONSTRAINT actions_pkey PRIMARY KEY (id); + + +-- +-- Name: bank_statements bank_statements_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.bank_statements + ADD CONSTRAINT bank_statements_pkey PRIMARY KEY (id); + + +-- +-- Name: bank_transactions bank_transactions_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.bank_transactions + ADD CONSTRAINT bank_transactions_pkey PRIMARY KEY (id); + + +-- +-- Name: blocked_domains blocked_domains_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.blocked_domains + ADD CONSTRAINT blocked_domains_pkey PRIMARY KEY (id); + + +-- +-- Name: certificates certificates_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.certificates + ADD CONSTRAINT certificates_pkey PRIMARY KEY (id); + + +-- +-- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.contacts + ADD CONSTRAINT contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: dnskeys dnskeys_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.dnskeys + ADD CONSTRAINT dnskeys_pkey PRIMARY KEY (id); + + +-- +-- Name: domain_contacts domain_contacts_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.domain_contacts + ADD CONSTRAINT domain_contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: domains domains_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.domains + ADD CONSTRAINT domains_pkey PRIMARY KEY (id); + + +-- +-- Name: invoice_items invoice_items_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.invoice_items + ADD CONSTRAINT invoice_items_pkey PRIMARY KEY (id); + + +-- +-- Name: invoices invoices_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.invoices + ADD CONSTRAINT invoices_pkey PRIMARY KEY (id); + + +-- +-- Name: nameservers nameservers_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.nameservers + ADD CONSTRAINT nameservers_pkey PRIMARY KEY (id); + + +-- +-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.notifications + ADD CONSTRAINT notifications_pkey PRIMARY KEY (id); + + +-- +-- Name: payment_orders payment_orders_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.payment_orders + ADD CONSTRAINT payment_orders_pkey PRIMARY KEY (id); + + +-- +-- Name: registrant_verifications registrant_verifications_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.registrant_verifications + ADD CONSTRAINT registrant_verifications_pkey PRIMARY KEY (id); + + +-- +-- Name: registrars registrars_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.registrars + ADD CONSTRAINT registrars_pkey PRIMARY KEY (id); + + +-- +-- Name: reserved_domains reserved_domains_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.reserved_domains + ADD CONSTRAINT reserved_domains_pkey PRIMARY KEY (id); + + +-- +-- Name: settings settings_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.settings + ADD CONSTRAINT settings_pkey PRIMARY KEY (id); + + +-- +-- Name: users users_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: white_ips white_ips_pkey; Type: CONSTRAINT; Schema: audit; Owner: - +-- + +ALTER TABLE ONLY audit.white_ips + ADD CONSTRAINT white_ips_pkey PRIMARY KEY (id); + + +-- +-- Name: account_activities account_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.account_activities @@ -3047,7 +4755,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 @@ -3055,7 +4763,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 @@ -3063,7 +4771,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 @@ -3071,7 +4779,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 @@ -3079,7 +4787,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 @@ -3087,7 +4795,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 @@ -3095,7 +4803,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 @@ -3103,7 +4811,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 @@ -3111,7 +4819,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 @@ -3119,7 +4827,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 @@ -3127,7 +4835,7 @@ ALTER TABLE ONLY public.directos -- --- Name: disputes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: disputes disputes_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.disputes @@ -3135,7 +4843,7 @@ ALTER TABLE ONLY public.disputes -- --- Name: dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: dnskeys dnskeys_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.dnskeys @@ -3143,7 +4851,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 @@ -3151,7 +4859,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 @@ -3159,7 +4867,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 @@ -3167,7 +4875,7 @@ ALTER TABLE ONLY public.domains -- --- Name: email_address_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: email_address_verifications email_address_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_address_verifications @@ -3175,7 +4883,7 @@ ALTER TABLE ONLY public.email_address_verifications -- --- Name: email_addresses_validations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: email_addresses_validations email_addresses_validations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_addresses_validations @@ -3183,7 +4891,7 @@ ALTER TABLE ONLY public.email_addresses_validations -- --- Name: email_addresses_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: email_addresses_verifications email_addresses_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_addresses_verifications @@ -3191,7 +4899,7 @@ ALTER TABLE ONLY public.email_addresses_verifications -- --- 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 @@ -3199,7 +4907,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 @@ -3207,7 +4915,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 @@ -3215,7 +4923,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 @@ -3223,7 +4931,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 @@ -3231,7 +4939,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 @@ -3239,7 +4947,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 @@ -3247,7 +4955,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 @@ -3255,7 +4963,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 @@ -3263,7 +4971,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 @@ -3271,7 +4979,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 @@ -3279,7 +4987,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 @@ -3287,7 +4995,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 @@ -3295,7 +5003,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 @@ -3303,7 +5011,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 @@ -3311,7 +5019,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 @@ -3319,7 +5027,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 @@ -3327,7 +5035,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 @@ -3335,7 +5043,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 @@ -3343,7 +5051,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 @@ -3367,7 +5075,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 @@ -3375,7 +5083,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 @@ -3383,7 +5091,7 @@ ALTER TABLE ONLY public.log_reserved_domains -- --- Name: log_setting_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: log_setting_entries log_setting_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_setting_entries @@ -3391,7 +5099,7 @@ ALTER TABLE ONLY public.log_setting_entries -- --- 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 @@ -3399,7 +5107,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 @@ -3407,7 +5115,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 @@ -3415,7 +5123,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 @@ -3423,7 +5131,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 @@ -3431,7 +5139,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 @@ -3439,7 +5147,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 @@ -3447,7 +5155,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 @@ -3455,7 +5163,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 @@ -3463,7 +5171,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 @@ -3471,7 +5179,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 @@ -3479,7 +5187,7 @@ ALTER TABLE ONLY public.reserved_domains -- --- Name: setting_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: setting_entries setting_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.setting_entries @@ -3487,7 +5195,7 @@ ALTER TABLE ONLY public.setting_entries -- --- Name: settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: settings settings_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.settings @@ -3495,7 +5203,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 @@ -3503,7 +5211,7 @@ ALTER TABLE ONLY public.blocked_domains -- --- Name: uniq_contact_of_type_per_domain; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: domain_contacts uniq_contact_of_type_per_domain; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.domain_contacts @@ -3511,7 +5219,7 @@ ALTER TABLE ONLY public.domain_contacts -- --- 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 @@ -3519,7 +5227,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 @@ -3527,7 +5235,7 @@ ALTER TABLE ONLY public.domains -- --- Name: uniq_hostname_per_domain; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- Name: nameservers uniq_hostname_per_domain; Type: CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.nameservers @@ -3535,7 +5243,7 @@ ALTER TABLE ONLY public.nameservers -- --- 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 @@ -3543,7 +5251,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 @@ -3551,7 +5259,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 @@ -3559,7 +5267,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 @@ -3567,7 +5275,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 @@ -3575,7 +5283,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 @@ -3583,7 +5291,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 @@ -3591,7 +5299,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 @@ -3599,7 +5307,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 @@ -3607,7 +5315,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 @@ -3615,7 +5323,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 @@ -3623,7 +5331,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 @@ -3631,7 +5339,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 @@ -3639,7 +5347,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 @@ -3647,7 +5355,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 @@ -3655,622 +5363,1113 @@ ALTER TABLE ONLY public.zones -- --- Name: index_account_activities_on_account_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: account_activities_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX account_activities_object_id_idx ON audit.account_activities USING btree (object_id); + + +-- +-- Name: account_activities_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX account_activities_recorded_at_idx ON audit.account_activities USING btree (recorded_at); + + +-- +-- Name: accounts_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX accounts_object_id_idx ON audit.accounts USING btree (object_id); + + +-- +-- Name: accounts_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX accounts_recorded_at_idx ON audit.accounts USING btree (recorded_at); + + +-- +-- Name: actions_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX actions_object_id_idx ON audit.actions USING btree (object_id); + + +-- +-- Name: actions_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX actions_recorded_at_idx ON audit.actions USING btree (recorded_at); + + +-- +-- Name: bank_statements_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX bank_statements_object_id_idx ON audit.bank_statements USING btree (object_id); + + +-- +-- Name: bank_statements_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX bank_statements_recorded_at_idx ON audit.bank_statements USING btree (recorded_at); + + +-- +-- Name: bank_transactions_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX bank_transactions_object_id_idx ON audit.bank_transactions USING btree (object_id); + + +-- +-- Name: bank_transactions_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX bank_transactions_recorded_at_idx ON audit.bank_transactions USING btree (recorded_at); + + +-- +-- Name: blocked_domains_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX blocked_domains_object_id_idx ON audit.blocked_domains USING btree (object_id); + + +-- +-- Name: blocked_domains_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX blocked_domains_recorded_at_idx ON audit.blocked_domains USING btree (recorded_at); + + +-- +-- Name: certificates_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX certificates_object_id_idx ON audit.certificates USING btree (object_id); + + +-- +-- Name: certificates_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX certificates_recorded_at_idx ON audit.certificates USING btree (recorded_at); + + +-- +-- 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: dnskeys_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX dnskeys_object_id_idx ON audit.dnskeys USING btree (object_id); + + +-- +-- Name: dnskeys_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX dnskeys_recorded_at_idx ON audit.dnskeys USING btree (recorded_at); + + +-- +-- Name: domain_contacts_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX domain_contacts_object_id_idx ON audit.domain_contacts USING btree (object_id); + + +-- +-- Name: domain_contacts_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX domain_contacts_recorded_at_idx ON audit.domain_contacts USING btree (recorded_at); + + +-- +-- Name: domains_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX domains_object_id_idx ON audit.domains USING btree (object_id); + + +-- +-- Name: domains_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX domains_recorded_at_idx ON audit.domains USING btree (recorded_at); + + +-- +-- Name: invoice_items_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX invoice_items_object_id_idx ON audit.invoice_items USING btree (object_id); + + +-- +-- Name: invoice_items_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX invoice_items_recorded_at_idx ON audit.invoice_items USING btree (recorded_at); + + +-- +-- Name: invoices_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX invoices_object_id_idx ON audit.invoices USING btree (object_id); + + +-- +-- Name: invoices_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX invoices_recorded_at_idx ON audit.invoices USING btree (recorded_at); + + +-- +-- Name: nameservers_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX nameservers_object_id_idx ON audit.nameservers USING btree (object_id); + + +-- +-- Name: nameservers_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX nameservers_recorded_at_idx ON audit.nameservers USING btree (recorded_at); + + +-- +-- Name: notifications_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX notifications_object_id_idx ON audit.notifications USING btree (object_id); + + +-- +-- Name: notifications_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX notifications_recorded_at_idx ON audit.notifications USING btree (recorded_at); + + +-- +-- Name: payment_orders_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX payment_orders_object_id_idx ON audit.payment_orders USING btree (object_id); + + +-- +-- Name: payment_orders_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX payment_orders_recorded_at_idx ON audit.payment_orders USING btree (recorded_at); + + +-- +-- Name: registrant_verifications_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX registrant_verifications_object_id_idx ON audit.registrant_verifications USING btree (object_id); + + +-- +-- Name: registrant_verifications_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX registrant_verifications_recorded_at_idx ON audit.registrant_verifications USING btree (recorded_at); + + +-- +-- Name: registrars_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX registrars_object_id_idx ON audit.registrars USING btree (object_id); + + +-- +-- Name: registrars_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX registrars_recorded_at_idx ON audit.registrars USING btree (recorded_at); + + +-- +-- Name: reserved_domains_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX reserved_domains_object_id_idx ON audit.reserved_domains USING btree (object_id); + + +-- +-- Name: reserved_domains_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX reserved_domains_recorded_at_idx ON audit.reserved_domains USING btree (recorded_at); + + +-- +-- Name: settings_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX settings_object_id_idx ON audit.settings USING btree (object_id); + + +-- +-- Name: settings_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX settings_recorded_at_idx ON audit.settings USING btree (recorded_at); + + +-- +-- Name: users_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX users_object_id_idx ON audit.users USING btree (object_id); + + +-- +-- Name: users_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX users_recorded_at_idx ON audit.users USING btree (recorded_at); + + +-- +-- Name: white_ips_object_id_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX white_ips_object_id_idx ON audit.white_ips USING btree (object_id); + + +-- +-- Name: white_ips_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - +-- + +CREATE INDEX white_ips_recorded_at_idx ON audit.white_ips 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_email_address_verifications_on_domain; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_email_address_verifications_on_domain; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_email_address_verifications_on_domain ON public.email_address_verifications USING btree (domain); -- --- Name: index_epp_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_email_address_verifications_on_email; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_email_address_verifications_on_email ON public.email_address_verifications USING btree (email); + + +-- +-- Name: index_email_addresses_validations_on_email; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_email_addresses_validations_on_email ON public.email_addresses_validations USING btree (email); + + +-- +-- 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_prices_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_log_prices_on_item_type_and_item_id ON public.log_prices USING btree (item_type, item_id); + + +-- +-- Name: index_log_prices_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_log_prices_on_whodunnit ON public.log_prices USING btree (whodunnit); + + +-- +-- 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_setting_entries_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_setting_entries_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_setting_entries_on_item_type_and_item_id ON public.log_setting_entries USING btree (item_type, item_id); -- --- Name: index_log_setting_entries_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_log_setting_entries_on_whodunnit; Type: INDEX; Schema: public; Owner: - -- CREATE INDEX index_log_setting_entries_on_whodunnit ON public.log_setting_entries 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_setting_entries_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_setting_entries_on_code; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_setting_entries_on_code ON public.setting_entries USING btree (code); -- --- 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_provider_and_uid; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: index_users_on_provider_and_uid; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX index_users_on_provider_and_uid ON public.users USING btree (provider, uid); -- --- 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_data_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- Name: unique_data_migrations; Type: INDEX; Schema: public; Owner: - -- CREATE UNIQUE INDEX unique_data_migrations ON public.data_migrations USING btree (version); -- --- 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: account_activities process_account_activity_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_account_activity_audit AFTER INSERT OR DELETE OR UPDATE ON public.account_activities FOR EACH ROW EXECUTE PROCEDURE public.process_account_activity_audit(); + + +-- +-- Name: accounts process_account_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_account_audit AFTER INSERT OR DELETE OR UPDATE ON public.accounts FOR EACH ROW EXECUTE PROCEDURE public.process_account_audit(); + + +-- +-- Name: actions process_action_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_action_audit AFTER INSERT OR DELETE OR UPDATE ON public.actions FOR EACH ROW EXECUTE PROCEDURE public.process_action_audit(); + + +-- +-- Name: bank_statements process_bank_statement_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_bank_statement_audit AFTER INSERT OR DELETE OR UPDATE ON public.bank_statements FOR EACH ROW EXECUTE PROCEDURE public.process_bank_statement_audit(); + + +-- +-- Name: bank_transactions process_bank_transaction_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_bank_transaction_audit AFTER INSERT OR DELETE OR UPDATE ON public.bank_transactions FOR EACH ROW EXECUTE PROCEDURE public.process_bank_transaction_audit(); + + +-- +-- Name: blocked_domains process_blocked_domain_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_blocked_domain_audit AFTER INSERT OR DELETE OR UPDATE ON public.blocked_domains FOR EACH ROW EXECUTE PROCEDURE public.process_blocked_domain_audit(); + + +-- +-- Name: certificates process_certificate_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_certificate_audit AFTER INSERT OR DELETE OR UPDATE ON public.certificates FOR EACH ROW EXECUTE PROCEDURE public.process_certificate_audit(); + + +-- +-- 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: dnskeys process_dnskey_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_dnskey_audit AFTER INSERT OR DELETE OR UPDATE ON public.dnskeys FOR EACH ROW EXECUTE PROCEDURE public.process_dnskey_audit(); + + +-- +-- Name: domains process_domain_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_domain_audit AFTER INSERT OR DELETE OR UPDATE ON public.domains FOR EACH ROW EXECUTE PROCEDURE public.process_domain_audit(); + + +-- +-- Name: domain_contacts process_domain_contact_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_domain_contact_audit AFTER INSERT OR DELETE OR UPDATE ON public.domain_contacts FOR EACH ROW EXECUTE PROCEDURE public.process_domain_contact_audit(); + + +-- +-- Name: invoices process_invoice_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_invoice_audit AFTER INSERT OR DELETE OR UPDATE ON public.invoices FOR EACH ROW EXECUTE PROCEDURE public.process_invoice_audit(); + + +-- +-- Name: invoice_items process_invoice_item_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_invoice_item_audit AFTER INSERT OR DELETE OR UPDATE ON public.invoice_items FOR EACH ROW EXECUTE PROCEDURE public.process_invoice_item_audit(); + + +-- +-- Name: nameservers process_nameserver_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_nameserver_audit AFTER INSERT OR DELETE OR UPDATE ON public.nameservers FOR EACH ROW EXECUTE PROCEDURE public.process_nameserver_audit(); + + +-- +-- Name: notifications process_notification_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_notification_audit AFTER INSERT OR DELETE OR UPDATE ON public.notifications FOR EACH ROW EXECUTE PROCEDURE public.process_notification_audit(); + + +-- +-- Name: payment_orders process_payment_order_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_payment_order_audit AFTER INSERT OR DELETE OR UPDATE ON public.payment_orders FOR EACH ROW EXECUTE PROCEDURE public.process_payment_order_audit(); + + +-- +-- Name: registrant_verifications process_registrant_verification_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_registrant_verification_audit AFTER INSERT OR DELETE OR UPDATE ON public.registrant_verifications FOR EACH ROW EXECUTE PROCEDURE public.process_registrant_verification_audit(); + + +-- +-- Name: registrars process_registrar_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_registrar_audit AFTER INSERT OR DELETE OR UPDATE ON public.registrars FOR EACH ROW EXECUTE PROCEDURE public.process_registrar_audit(); + + +-- +-- Name: reserved_domains process_reserved_domain_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_reserved_domain_audit AFTER INSERT OR DELETE OR UPDATE ON public.reserved_domains FOR EACH ROW EXECUTE PROCEDURE public.process_reserved_domain_audit(); + + +-- +-- Name: settings process_setting_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_setting_audit AFTER INSERT OR DELETE OR UPDATE ON public.settings FOR EACH ROW EXECUTE PROCEDURE public.process_setting_audit(); + + +-- +-- Name: users process_user_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_user_audit AFTER INSERT OR DELETE OR UPDATE ON public.users FOR EACH ROW EXECUTE PROCEDURE public.process_user_audit(); + + +-- +-- Name: white_ips process_white_ip_audit; Type: TRIGGER; Schema: public; Owner: - +-- + +CREATE TRIGGER process_white_ip_audit AFTER INSERT OR DELETE OR UPDATE ON public.white_ips FOR EACH ROW EXECUTE PROCEDURE public.process_white_ip_audit(); + + +-- +-- Name: contacts contacts_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: - -- ALTER TABLE ONLY public.contacts @@ -4278,7 +6477,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 @@ -4286,7 +6485,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 @@ -4294,7 +6493,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 @@ -4302,7 +6501,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 @@ -4310,7 +6509,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 @@ -4318,7 +6517,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 @@ -4326,7 +6525,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 @@ -4334,7 +6533,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 @@ -4342,7 +6541,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 @@ -4350,7 +6549,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 @@ -4358,7 +6557,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 @@ -4366,7 +6565,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 @@ -4374,7 +6573,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 @@ -4382,7 +6581,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 @@ -4390,7 +6589,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 @@ -4398,7 +6597,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 @@ -4406,7 +6605,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 @@ -4414,7 +6613,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 @@ -4422,7 +6621,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 @@ -4430,7 +6629,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 @@ -4438,7 +6637,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 @@ -4446,7 +6645,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 @@ -4454,7 +6653,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 @@ -4462,7 +6661,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 @@ -4470,7 +6669,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 @@ -4896,7 +7095,14 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200130092113'), ('20200203143458'), ('20200204103125'), +('20200310105731'), +('20200310105736'), ('20200311114649'), +('20200319082650'), +('20200320090152'), +('20200320094842'), +('20200330111918'), +('20200408091005'), ('20200417075720'), ('20200421093637'), ('20200505103316'), @@ -4905,6 +7111,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200529115011'), ('20200605100827'), ('20200610090110'), +('20200622080240'), ('20200630081231'), ('20200714115338'), ('20200807110611'), @@ -4917,3 +7124,4 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200910102028'), ('20200915073245'); + From d256aa357e549d98f788f41d25fb47eed5fd297f Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Fri, 25 Sep 2020 11:25:46 +0500 Subject: [PATCH 05/16] Hardcode test tara creds to check on staging --- config/initializers/omniauth.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 0e0ab9142..b99958efd 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -9,12 +9,12 @@ OmniAuth.config.logger = Rails.logger # Block GET requests to avoid exposing self to CVE-2015-9284 OmniAuth.config.allowed_request_methods = [:post] -signing_keys = ENV['tara_keys'] -issuer = ENV['tara_issuer'] -host = ENV['tara_host'] -identifier = ENV['tara_identifier'] -secret = ENV['tara_secret'] -redirect_uri = ENV['tara_redirect_uri'] +signing_keys = "{\"kty\":\"RSA\",\"kid\":\"de6cc4\",\"n\":\"jWwAjT_03ypme9ZWeSe7c-jY26NO50Wo5I1LBnPW2JLc0dPMj8v7y4ehiRpClYNTaSWcLd4DJmlKXDXXudEUWwXa7TtjBFJfzlZ-1u0tDvJ-H9zv9MzO7UhUFytztUEMTrtStdhGbzkzdEZZCgFYeo2i33eXxzIR1nGvI05d9Y-e_LHnNE2ZKTa89BC7ZiCXq5nfAaCgQna_knh4kFAX-KgiPRAtsiDHcAWKcBY3qUVcb-5XAX8p668MlGLukzsh5tFkQCbJVyNtmlbIHdbGvVHPb8C0H3oLYciv1Fjy_tS1lO7OT_cb3GVp6Ql-CG0uED_8pkpVtfsGRviub4_ElQ\",\"e\":\"AQAB\"}" +issuer = 'https://tara-test.ria.ee' +host = 'tara-test.ria.ee' +identifier = 'registripidaja_test' +secret = 'MdNnRBmc1JrDJUe_9h4qy52d' +redirect_uri = 'https://st-rar.infra.tld.ee/registrar/open_id/callback' Rails.application.config.middleware.use OmniAuth::Builder do provider "tara", { From 227c2f100dad8a38fcedffb786a37ccf9c5e031d Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Fri, 25 Sep 2020 13:20:27 +0500 Subject: [PATCH 06/16] Set OmniAuth on failure config --- Gemfile | 1 + Gemfile.lock | 1 + app/controllers/registrar/tara_controller.rb | 2 + app/models/api_user.rb | 2 +- app/models/registrant_user.rb | 2 +- config/environments/production.rb | 2 +- config/initializers/devise.rb | 10 +-- config/initializers/omniauth.rb | 20 ++--- .../strategies/id_card_authenticatable.rb | 84 +++++++++---------- 9 files changed, 64 insertions(+), 60 deletions(-) diff --git a/Gemfile b/Gemfile index 15d5f779c..6ba54e871 100644 --- a/Gemfile +++ b/Gemfile @@ -54,6 +54,7 @@ gem 'digidoc_client', ref: '1645e83a5a548addce383f75703b0275c5310c32' # TARA +gem 'omniauth' gem 'omniauth-rails_csrf_protection' gem 'omniauth-tara', github: 'internetee/omniauth-tara' diff --git a/Gemfile.lock b/Gemfile.lock index 574afc9df..1a45ed826 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -555,6 +555,7 @@ DEPENDENCIES minitest (~> 5.14) money-rails nokogiri + omniauth omniauth-rails_csrf_protection omniauth-tara! paper_trail (~> 10.3) diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb index 0d0805e2d..5be54ec12 100644 --- a/app/controllers/registrar/tara_controller.rb +++ b/app/controllers/registrar/tara_controller.rb @@ -2,6 +2,8 @@ require 'tampering_detected' class Registrar class TaraController < ApplicationController + skip_authorization_check + rescue_from Errors::TamperingDetected do redirect_to root_url, alert: t('auth.tara.tampering') end diff --git a/app/models/api_user.rb b/app/models/api_user.rb index d7b264495..12096bae7 100644 --- a/app/models/api_user.rb +++ b/app/models/api_user.rb @@ -2,7 +2,7 @@ require 'open3' class ApiUser < User include EppErrors - devise :database_authenticatable, :trackable, :timeoutable, :id_card_authenticatable, + devise :database_authenticatable, :trackable, :timeoutable, #:id_card_authenticatable, authentication_keys: [:username] def epp_code_map diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index e7ce9cc3b..e739d4a9d 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -1,7 +1,7 @@ class RegistrantUser < User attr_accessor :idc_data - devise :trackable, :timeoutable, :id_card_authenticatable + devise :trackable, :timeoutable#, :id_card_authenticatable def ability @ability ||= Ability.new(self) diff --git a/config/environments/production.rb b/config/environments/production.rb index 6e13ea1f7..377166f29 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -43,7 +43,7 @@ Rails.application.configure do # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 10f937f40..3c1a9015c 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -9,7 +9,7 @@ Devise.setup do |config| # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. config.secret_key = ENV['devise_secret'] - + # ==> Controller configuration # Configure the parent class to the devise controllers. # config.parent_controller = 'DeviseController' @@ -281,9 +281,9 @@ Devise.setup do |config| # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' - require 'devise/models/id_card_authenticatable' - require 'devise/strategies/id_card_authenticatable' + # require 'devise/models/id_card_authenticatable' + # require 'devise/strategies/id_card_authenticatable' - routes = [nil, :new, :destroy] - config.add_module :id_card_authenticatable, strategy: true, route: { session: routes } + # routes = [nil, :new, :destroy] + # config.add_module :id_card_authenticatable, strategy: true, route: { session: routes } end diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index b99958efd..299ddceec 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,20 +1,20 @@ OpenIDConnect.logger = Rails.logger OpenIDConnect.debug! -OpenIDConnect.http_config do |config| - config.proxy = AuctionCenter::Application.config.customization.dig(:tara, :proxy) -end +OmniAuth.config.on_failure = Proc.new { |env| + OmniAuth::FailureEndpoint.new(env).redirect_to_failure +} OmniAuth.config.logger = Rails.logger # Block GET requests to avoid exposing self to CVE-2015-9284 OmniAuth.config.allowed_request_methods = [:post] -signing_keys = "{\"kty\":\"RSA\",\"kid\":\"de6cc4\",\"n\":\"jWwAjT_03ypme9ZWeSe7c-jY26NO50Wo5I1LBnPW2JLc0dPMj8v7y4ehiRpClYNTaSWcLd4DJmlKXDXXudEUWwXa7TtjBFJfzlZ-1u0tDvJ-H9zv9MzO7UhUFytztUEMTrtStdhGbzkzdEZZCgFYeo2i33eXxzIR1nGvI05d9Y-e_LHnNE2ZKTa89BC7ZiCXq5nfAaCgQna_knh4kFAX-KgiPRAtsiDHcAWKcBY3qUVcb-5XAX8p668MlGLukzsh5tFkQCbJVyNtmlbIHdbGvVHPb8C0H3oLYciv1Fjy_tS1lO7OT_cb3GVp6Ql-CG0uED_8pkpVtfsGRviub4_ElQ\",\"e\":\"AQAB\"}" -issuer = 'https://tara-test.ria.ee' -host = 'tara-test.ria.ee' -identifier = 'registripidaja_test' -secret = 'MdNnRBmc1JrDJUe_9h4qy52d' -redirect_uri = 'https://st-rar.infra.tld.ee/registrar/open_id/callback' +signing_keys = ENV['tara_keys'] +issuer = ENV['tara_issuer'] +host = ENV['tara_host'] +identifier = ENV['tara_identifier'] +secret = ENV['tara_secret'] +redirect_uri = ENV['tara_redirect_uri'] Rails.application.config.middleware.use OmniAuth::Builder do provider "tara", { @@ -36,7 +36,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do userinfo_endpoint: nil, # Not implemented jwks_uri: '/oidc/jwks', - # Auction + # Registry identifier: identifier, secret: secret, redirect_uri: redirect_uri, diff --git a/lib/devise/strategies/id_card_authenticatable.rb b/lib/devise/strategies/id_card_authenticatable.rb index ec26bb4d9..5ee6bf75d 100644 --- a/lib/devise/strategies/id_card_authenticatable.rb +++ b/lib/devise/strategies/id_card_authenticatable.rb @@ -1,49 +1,49 @@ module Devise module Strategies class IdCardAuthenticatable < Devise::Strategies::Authenticatable - def valid? - env['SSL_CLIENT_S_DN_CN'].present? - end - - def authenticate! - resource = mapping.to - user = resource.find_by_id_card(id_card) - - if user - success!(user) - else - fail - end - end - - private - - def id_card - id_card = IdCard.new - id_card.first_name = first_name - id_card.last_name = last_name - id_card.personal_code = personal_code - id_card.country_code = country_code - id_card - end - - def first_name - env['SSL_CLIENT_S_DN_CN'].split(',').second.force_encoding('utf-8') - end - - def last_name - env['SSL_CLIENT_S_DN_CN'].split(',').first.force_encoding('utf-8') - end - - def personal_code - env['SSL_CLIENT_S_DN_CN'].split(',').last - end - - def country_code - env['SSL_CLIENT_I_DN_C'] - end + # def valid? + # env['SSL_CLIENT_S_DN_CN'].present? + # end + # + # def authenticate! + # resource = mapping.to + # user = resource.find_by_id_card(id_card) + # + # if user + # success!(user) + # else + # fail + # end + # end + # + # private + # + # def id_card + # id_card = IdCard.new + # id_card.first_name = first_name + # id_card.last_name = last_name + # id_card.personal_code = personal_code + # id_card.country_code = country_code + # id_card + # end + # + # def first_name + # env['SSL_CLIENT_S_DN_CN'].split(',').second.force_encoding('utf-8') + # end + # + # def last_name + # env['SSL_CLIENT_S_DN_CN'].split(',').first.force_encoding('utf-8') + # end + # + # def personal_code + # env['SSL_CLIENT_S_DN_CN'].split(',').last + # end + # + # def country_code + # env['SSL_CLIENT_I_DN_C'] + # end end end end -Warden::Strategies.add(:id_card_authenticatable, Devise::Strategies::IdCardAuthenticatable) \ No newline at end of file +# Warden::Strategies.add(:id_card_authenticatable, Devise::Strategies::IdCardAuthenticatable) From a3042c39ee0c3b2a7781a022b76dc46d8f067f3e Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Mon, 28 Sep 2020 14:36:40 +0500 Subject: [PATCH 07/16] Try to set callback_path explicitly --- config/initializers/omniauth.rb | 1 + config/routes.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 299ddceec..ef5350384 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -18,6 +18,7 @@ redirect_uri = ENV['tara_redirect_uri'] Rails.application.config.middleware.use OmniAuth::Builder do provider "tara", { + callback_path: '/registrar/open_id/callback', name: 'tara', scope: ['openid'], state: Proc.new{ SecureRandom.hex(10) }, diff --git a/config/routes.rb b/config/routes.rb index b02c757fd..d88a2fdbc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,14 +77,14 @@ Rails.application.routes.draw do devise_for :users, path: '', class_name: 'ApiUser', skip: %i[sessions] devise_scope :registrar_user do - get 'login/mid' => 'sessions#login_mid' - post 'login/mid' => 'sessions#mid' - post 'login/mid_status' => 'sessions#mid_status' + # get 'login/mid' => 'sessions#login_mid' + # post 'login/mid' => 'sessions#mid' + # post 'login/mid_status' => 'sessions#mid_status' # /registrar/id path is hardcoded in Apache config for authentication with Estonian ID-card - post 'id' => 'sessions#id_card', as: :id_card_sign_in - - post 'mid' => 'sessions#mid' + # post 'id' => 'sessions#id_card', as: :id_card_sign_in + # + # post 'mid' => 'sessions#mid' match '/open_id/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback match '/open_id/cancel', via: %i[get post delete], to: 'tara#cancel', From bb37527daedeecc696a27801f38161aca0001d56 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Tue, 29 Sep 2020 12:21:04 +0500 Subject: [PATCH 08/16] Use Tara user hash --- app/controllers/registrar/tara_controller.rb | 72 ++++++++------------ app/models/user.rb | 39 +++++------ config/routes.rb | 2 +- 3 files changed, 45 insertions(+), 68 deletions(-) diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb index 5be54ec12..4514655d0 100644 --- a/app/controllers/registrar/tara_controller.rb +++ b/app/controllers/registrar/tara_controller.rb @@ -1,41 +1,33 @@ -require 'tampering_detected' - class Registrar class TaraController < ApplicationController skip_authorization_check - rescue_from Errors::TamperingDetected do - redirect_to root_url, alert: t('auth.tara.tampering') - end - def callback session[:omniauth_hash] = user_hash - @user = User.from_omniauth(user_hash) + @api_user = ApiUser.from_omniauth(user_hash) - return unless @user.persisted? + return unless @api_user.persisted? - sign_in(User, @user) - redirect_to user_path(@user.uuid), notice: t('devise.sessions.signed_in') + sign_in_and_redirect(:registrar_user, @api_user) end # rubocop:disable Metrics/MethodLength - def create - tara_logger.info create_params - @user = User.new(create_params) - check_for_tampering - create_password - - respond_to do |format| - if @user.save - format.html do - sign_in(User, @user) - redirect_to user_path(@user.uuid), notice: t(:created) - end - else - format.html { render :callback } - end - end - end + # def create + # @user = User.new(create_params) + # check_for_tampering + # create_password + # + # respond_to do |format| + # if @user.save + # format.html do + # sign_in(User, @user) + # redirect_to user_path(@user.uuid), notice: t(:created) + # end + # else + # format.html { render :callback } + # end + # end + # end # rubocop:enable Metrics/MethodLength def cancel @@ -44,30 +36,22 @@ class Registrar private - def create_params - params.require(:user) - .permit(:email, :identity_code, :country_code, :given_names, :surname, - :accepts_terms_and_conditions, :locale, :uid, :provider) - end + # def create_params + # params.require(:user) + # .permit(:email, :identity_code, :country_code, :given_names, :surname, + # :accepts_terms_and_conditions, :locale, :uid, :provider) + # end - def check_for_tampering - return unless @user.tampered_with?(session[:omniauth_hash]) - - session.delete(:omniauth_hash) - raise Errors::TamperingDetected - end - - def create_password - @user.password = Devise.friendly_token[0..20] - end + # def create_password + # @user.password = Devise.friendly_token[0..20] + # end def user_hash - tara_logger.info request.env request.env['omniauth.auth'] end def tara_logger - @tara_logger ||= Logger.new(Rails.root.join('log', 'tara_auth2.log')) + @tara_logger ||= Logger.new(Rails.root.join('log', 'tara_auth4.log')) end end end diff --git a/app/models/user.rb b/app/models/user.rb index d3221b137..c31cc6bbe 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -15,34 +15,27 @@ class User < ApplicationRecord end # rubocop:disable Metrics/AbcSize - def tampered_with?(omniauth_hash) - # uid_from_hash = omniauth_hash['uid'] - # provider_from_hash = omniauth_hash['provider'] - # - # begin - # uid != uid_from_hash || - # provider != provider_from_hash || - # country_code != uid_from_hash.slice(0..1) || - # identity_code != uid_from_hash.slice(2..-1) || - # given_names != omniauth_hash.dig('info', 'first_name') || - # surname != omniauth_hash.dig('info', 'last_name') - # end - false - end + # def tampered_with?(omniauth_hash) + # # uid_from_hash = omniauth_hash['uid'] + # # provider_from_hash = omniauth_hash['provider'] + # # + # # begin + # # uid != uid_from_hash || + # # provider != provider_from_hash || + # # country_code != uid_from_hash.slice(0..1) || + # # identity_code != uid_from_hash.slice(2..-1) || + # # given_names != omniauth_hash.dig('info', 'first_name') || + # # surname != omniauth_hash.dig('info', 'last_name') + # # end + # false + # end # rubocop:enable Metrics/AbcSize def self.from_omniauth(omniauth_hash) uid = omniauth_hash['uid'] - provider = omniauth_hash['provider'] + # provider = omniauth_hash['provider'] - User.find_or_initialize_by(provider: provider, uid: uid) do |user| - user.given_names = omniauth_hash.dig('info', 'first_name') - user.surname = omniauth_hash.dig('info', 'last_name') - if provider == TARA_PROVIDER - user.country_code = uid.slice(0..1) - user.identity_code = uid.slice(2..-1) - end - end + User.find_by(uid: uid) end end diff --git a/config/routes.rb b/config/routes.rb index d88a2fdbc..5104a4ec5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -89,7 +89,7 @@ Rails.application.routes.draw do match '/open_id/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback match '/open_id/cancel', via: %i[get post delete], to: 'tara#cancel', as: :tara_cancel - match '/open_id/create', via: [:post], to: 'tara#create', as: :tara_create + # match '/open_id/create', via: [:post], to: 'tara#create', as: :tara_create end resources :invoices, except: %i[new create edit update destroy] do From 0d716e110a6c371f6ebc1df652fc7526d626a7a3 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Tue, 29 Sep 2020 14:17:00 +0500 Subject: [PATCH 09/16] Cleanup --- app/controllers/registrar/tara_controller.rb | 33 -------------------- app/models/registrant_user.rb | 2 +- app/models/user.rb | 22 ++----------- config/routes.rb | 1 - 4 files changed, 4 insertions(+), 54 deletions(-) diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb index 4514655d0..31c812c73 100644 --- a/app/controllers/registrar/tara_controller.rb +++ b/app/controllers/registrar/tara_controller.rb @@ -11,47 +11,14 @@ class Registrar sign_in_and_redirect(:registrar_user, @api_user) end - # rubocop:disable Metrics/MethodLength - # def create - # @user = User.new(create_params) - # check_for_tampering - # create_password - # - # respond_to do |format| - # if @user.save - # format.html do - # sign_in(User, @user) - # redirect_to user_path(@user.uuid), notice: t(:created) - # end - # else - # format.html { render :callback } - # end - # end - # end - # rubocop:enable Metrics/MethodLength - def cancel redirect_to root_path, notice: t(:sign_in_cancelled) end private - # def create_params - # params.require(:user) - # .permit(:email, :identity_code, :country_code, :given_names, :surname, - # :accepts_terms_and_conditions, :locale, :uid, :provider) - # end - - # def create_password - # @user.password = Devise.friendly_token[0..20] - # end - def user_hash request.env['omniauth.auth'] end - - def tara_logger - @tara_logger ||= Logger.new(Rails.root.join('log', 'tara_auth4.log')) - end end end diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index e739d4a9d..efe5dd782 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -1,7 +1,7 @@ class RegistrantUser < User attr_accessor :idc_data - devise :trackable, :timeoutable#, :id_card_authenticatable + devise :trackable, :timeoutable def ability @ability ||= Ability.new(self) diff --git a/app/models/user.rb b/app/models/user.rb index c31cc6bbe..b28c16304 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -14,28 +14,12 @@ class User < ApplicationRecord "#{self.id}-#{self.class}: #{self.username}" end - # rubocop:disable Metrics/AbcSize - # def tampered_with?(omniauth_hash) - # # uid_from_hash = omniauth_hash['uid'] - # # provider_from_hash = omniauth_hash['provider'] - # # - # # begin - # # uid != uid_from_hash || - # # provider != provider_from_hash || - # # country_code != uid_from_hash.slice(0..1) || - # # identity_code != uid_from_hash.slice(2..-1) || - # # given_names != omniauth_hash.dig('info', 'first_name') || - # # surname != omniauth_hash.dig('info', 'last_name') - # # end - # false - # end - # rubocop:enable Metrics/AbcSize - def self.from_omniauth(omniauth_hash) uid = omniauth_hash['uid'] - # provider = omniauth_hash['provider'] + identity_code = uid.slice(2..-1) + country_code = uid.slice(0..1) - User.find_by(uid: uid) + User.find_by(identity_code: identity_code, country_code: country_code) end end diff --git a/config/routes.rb b/config/routes.rb index 5104a4ec5..04f12694e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -89,7 +89,6 @@ Rails.application.routes.draw do match '/open_id/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback match '/open_id/cancel', via: %i[get post delete], to: 'tara#cancel', as: :tara_cancel - # match '/open_id/create', via: [:post], to: 'tara#create', as: :tara_create end resources :invoices, except: %i[new create edit update destroy] do From 94b8ffd158432e73a97dffb11483924e0ced9644 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 30 Sep 2020 13:06:59 +0500 Subject: [PATCH 10/16] Get rid of db changes --- ...00915073245_add_omniauth_fields_to_user.rb | 10 - db/structure.sql | 2873 ++--------------- 2 files changed, 328 insertions(+), 2555 deletions(-) delete mode 100644 db/migrate/20200915073245_add_omniauth_fields_to_user.rb diff --git a/db/migrate/20200915073245_add_omniauth_fields_to_user.rb b/db/migrate/20200915073245_add_omniauth_fields_to_user.rb deleted file mode 100644 index 8826559e3..000000000 --- a/db/migrate/20200915073245_add_omniauth_fields_to_user.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddOmniauthFieldsToUser < ActiveRecord::Migration[6.0] - disable_ddl_transaction! - - def change - add_column :users, :provider, :string - add_column :users, :uid, :string - add_index :users, [:provider, :uid], algorithm: :concurrently, - unique: true - end -end diff --git a/db/structure.sql b/db/structure.sql index 5ea01f91f..6a30fbc84 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1,19 +1,28 @@ +--- +--- 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: 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'; -- @@ -196,1398 +205,12 @@ CREATE FUNCTION public.generate_zonefile(i_origin character varying) RETURNS tex $_$; --- --- Name: process_account_activity_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_account_activity_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.account_activities - (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.account_activities - (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.account_activities - (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 -$$; - - --- --- Name: process_account_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_account_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.accounts - (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.accounts - (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.accounts - (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 -$$; - - --- --- Name: process_action_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_action_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.actions - (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.actions - (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.actions - (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 -$$; - - --- --- Name: process_bank_statement_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_bank_statement_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.bank_statements - (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.bank_statements - (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.bank_statements - (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 -$$; - - --- --- Name: process_bank_transaction_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_bank_transaction_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.bank_transactions - (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.bank_transactions - (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.bank_transactions - (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 -$$; - - --- --- Name: process_blocked_domain_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_blocked_domain_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.blocked_domains - (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.blocked_domains - (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.blocked_domains - (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 -$$; - - --- --- Name: process_certificate_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_certificate_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.certificates - (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.certificates - (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.certificates - (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 -$$; - - --- --- 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 -$$; - - --- --- Name: process_dnskey_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_dnskey_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.dnskeys - (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.dnskeys - (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.dnskeys - (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 -$$; - - --- --- Name: process_domain_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_domain_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.domains - (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.domains - (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.domains - (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 -$$; - - --- --- Name: process_domain_contact_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_domain_contact_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.domain_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.domain_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.domain_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 -$$; - - --- --- Name: process_invoice_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_invoice_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.invoices - (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.invoices - (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.invoices - (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 -$$; - - --- --- Name: process_invoice_item_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_invoice_item_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.invoice_items - (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.invoice_items - (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.invoice_items - (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 -$$; - - --- --- Name: process_nameserver_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_nameserver_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.nameservers - (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.nameservers - (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.nameservers - (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 -$$; - - --- --- Name: process_notification_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_notification_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.notifications - (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.notifications - (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.notifications - (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 -$$; - - --- --- Name: process_payment_order_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_payment_order_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.payment_orders - (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.payment_orders - (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.payment_orders - (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 -$$; - - --- --- Name: process_registrant_verification_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_registrant_verification_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.registrant_verifications - (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.registrant_verifications - (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.registrant_verifications - (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 -$$; - - --- --- Name: process_registrar_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_registrar_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.registrars - (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.registrars - (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.registrars - (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 -$$; - - --- --- Name: process_reserved_domain_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_reserved_domain_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.reserved_domains - (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.reserved_domains - (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.reserved_domains - (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 -$$; - - --- --- Name: process_setting_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_setting_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.settings - (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.settings - (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.settings - (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 -$$; - - --- --- Name: process_user_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_user_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.users - (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.users - (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.users - (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 -$$; - - --- --- Name: process_white_ip_audit(); Type: FUNCTION; Schema: public; Owner: - --- - -CREATE FUNCTION public.process_white_ip_audit() RETURNS trigger - LANGUAGE plpgsql - AS $$ - BEGIN - IF (TG_OP = 'INSERT') THEN - INSERT INTO audit.white_ips - (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.white_ips - (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.white_ips - (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: audit; Owner: - --- - -CREATE TABLE audit.account_activities ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT account_activities_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: account_activities_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.account_activities_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: account_activities_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.account_activities_id_seq OWNED BY audit.account_activities.id; - - --- --- Name: accounts; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.accounts ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT accounts_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: accounts_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.accounts_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.accounts_id_seq OWNED BY audit.accounts.id; - - --- --- Name: actions; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.actions ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT actions_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: actions_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.actions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: actions_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.actions_id_seq OWNED BY audit.actions.id; - - --- --- Name: bank_statements; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.bank_statements ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT bank_statements_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: bank_statements_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.bank_statements_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: bank_statements_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.bank_statements_id_seq OWNED BY audit.bank_statements.id; - - --- --- Name: bank_transactions; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.bank_transactions ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT bank_transactions_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: bank_transactions_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.bank_transactions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: bank_transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.bank_transactions_id_seq OWNED BY audit.bank_transactions.id; - - --- --- Name: blocked_domains; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.blocked_domains ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT blocked_domains_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: blocked_domains_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.blocked_domains_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: blocked_domains_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.blocked_domains_id_seq OWNED BY audit.blocked_domains.id; - - --- --- Name: certificates; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.certificates ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT certificates_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: certificates_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.certificates_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: certificates_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.certificates_id_seq OWNED BY audit.certificates.id; - - --- --- 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: dnskeys; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.dnskeys ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT dnskeys_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: dnskeys_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.dnskeys_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: dnskeys_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.dnskeys_id_seq OWNED BY audit.dnskeys.id; - - --- --- Name: domain_contacts; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.domain_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 domain_contacts_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: domain_contacts_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.domain_contacts_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: domain_contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.domain_contacts_id_seq OWNED BY audit.domain_contacts.id; - - --- --- Name: domains; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.domains ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT domains_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: domains_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.domains_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: domains_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.domains_id_seq OWNED BY audit.domains.id; - - --- --- Name: invoice_items; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.invoice_items ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT invoice_items_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: invoice_items_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.invoice_items_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: invoice_items_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.invoice_items_id_seq OWNED BY audit.invoice_items.id; - - --- --- Name: invoices; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.invoices ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT invoices_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: invoices_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.invoices_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: invoices_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.invoices_id_seq OWNED BY audit.invoices.id; - - --- --- Name: nameservers; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.nameservers ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT nameservers_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: nameservers_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.nameservers_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: nameservers_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.nameservers_id_seq OWNED BY audit.nameservers.id; - - --- --- Name: notifications; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.notifications ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT notifications_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: notifications_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.notifications_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.notifications_id_seq OWNED BY audit.notifications.id; - - --- --- Name: payment_orders; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.payment_orders ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT payment_orders_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: payment_orders_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.payment_orders_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: payment_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.payment_orders_id_seq OWNED BY audit.payment_orders.id; - - --- --- Name: registrant_verifications; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.registrant_verifications ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT registrant_verifications_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: registrant_verifications_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.registrant_verifications_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: registrant_verifications_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.registrant_verifications_id_seq OWNED BY audit.registrant_verifications.id; - - --- --- Name: registrars; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.registrars ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT registrars_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: registrars_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.registrars_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: registrars_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.registrars_id_seq OWNED BY audit.registrars.id; - - --- --- Name: reserved_domains; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.reserved_domains ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT reserved_domains_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: reserved_domains_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.reserved_domains_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: reserved_domains_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.reserved_domains_id_seq OWNED BY audit.reserved_domains.id; - - --- --- Name: settings; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.settings ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT settings_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: settings_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.settings_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: settings_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.settings_id_seq OWNED BY audit.settings.id; - - --- --- Name: users; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.users ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT users_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: users_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.users_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.users_id_seq OWNED BY audit.users.id; - - --- --- Name: white_ips; Type: TABLE; Schema: audit; Owner: - --- - -CREATE TABLE audit.white_ips ( - id integer NOT NULL, - object_id bigint, - action text NOT NULL, - recorded_at timestamp without time zone, - old_value jsonb, - new_value jsonb, - CONSTRAINT white_ips_action_check CHECK ((action = ANY (ARRAY['INSERT'::text, 'UPDATE'::text, 'DELETE'::text, 'TRUNCATE'::text]))) -); - - --- --- Name: white_ips_id_seq; Type: SEQUENCE; Schema: audit; Owner: - --- - -CREATE SEQUENCE audit.white_ips_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: white_ips_id_seq; Type: SEQUENCE OWNED BY; Schema: audit; Owner: - --- - -ALTER SEQUENCE audit.white_ips_id_seq OWNED BY audit.white_ips.id; - - --- --- Name: account_activities; Type: TABLE; Schema: public; Owner: - +-- Name: account_activities; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.account_activities ( @@ -1627,7 +250,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 ( @@ -1663,7 +286,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 ( @@ -1695,7 +318,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 ( @@ -1707,7 +330,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 ( @@ -1741,7 +364,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 ( @@ -1776,7 +399,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 ( @@ -1820,7 +443,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 ( @@ -1853,7 +476,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 ( @@ -1892,7 +515,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 ( @@ -1950,7 +573,7 @@ ALTER SEQUENCE public.contacts_id_seq OWNED BY public.contacts.id; -- --- Name: data_migrations; Type: TABLE; Schema: public; Owner: - +-- Name: data_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.data_migrations ( @@ -1959,7 +582,7 @@ CREATE TABLE public.data_migrations ( -- --- Name: directos; Type: TABLE; Schema: public; Owner: - +-- Name: directos; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.directos ( @@ -1994,7 +617,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 ( @@ -2031,7 +654,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 ( @@ -2072,7 +695,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 ( @@ -2110,7 +733,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 ( @@ -2147,7 +770,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 ( @@ -2182,8 +805,7 @@ CREATE TABLE public.domains ( uuid uuid DEFAULT public.gen_random_uuid() NOT NULL, locked_by_registrant_at timestamp without time zone, force_delete_start timestamp without time zone, - force_delete_data public.hstore, - children jsonb + force_delete_data public.hstore ); @@ -2207,7 +829,7 @@ ALTER SEQUENCE public.domains_id_seq OWNED BY public.domains.id; -- --- Name: email_address_verifications; Type: TABLE; Schema: public; Owner: - +-- Name: email_address_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.email_address_verifications ( @@ -2239,7 +861,7 @@ ALTER SEQUENCE public.email_address_verifications_id_seq OWNED BY public.email_a -- --- Name: email_addresses_validations; Type: TABLE; Schema: public; Owner: - +-- Name: email_addresses_validations; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.email_addresses_validations ( @@ -2269,7 +891,7 @@ ALTER SEQUENCE public.email_addresses_validations_id_seq OWNED BY public.email_a -- --- Name: email_addresses_verifications; Type: TABLE; Schema: public; Owner: - +-- Name: email_addresses_verifications; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.email_addresses_verifications ( @@ -2299,7 +921,7 @@ ALTER SEQUENCE public.email_addresses_verifications_id_seq OWNED BY public.email -- --- Name: epp_sessions; Type: TABLE; Schema: public; Owner: - +-- Name: epp_sessions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.epp_sessions ( @@ -2331,7 +953,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 ( @@ -2369,7 +991,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 ( @@ -2440,7 +1062,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 ( @@ -2475,7 +1097,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 ( @@ -2513,7 +1135,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 ( @@ -2551,7 +1173,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 ( @@ -2589,7 +1211,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 ( @@ -2627,7 +1249,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 ( @@ -2665,7 +1287,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 ( @@ -2703,7 +1325,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 ( @@ -2741,7 +1363,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 ( @@ -2780,7 +1402,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 ( @@ -2818,7 +1440,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 ( @@ -2856,7 +1478,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 ( @@ -2894,7 +1516,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 ( @@ -2932,7 +1554,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 ( @@ -2970,7 +1592,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 ( @@ -3008,7 +1630,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 ( @@ -3046,7 +1668,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 ( @@ -3159,7 +1781,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 ( @@ -3197,7 +1819,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 ( @@ -3235,7 +1857,7 @@ ALTER SEQUENCE public.log_reserved_domains_id_seq OWNED BY public.log_reserved_d -- --- Name: log_setting_entries; Type: TABLE; Schema: public; Owner: - +-- Name: log_setting_entries; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_setting_entries ( @@ -3273,7 +1895,7 @@ ALTER SEQUENCE public.log_setting_entries_id_seq OWNED BY public.log_setting_ent -- --- Name: log_settings; Type: TABLE; Schema: public; Owner: - +-- Name: log_settings; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.log_settings ( @@ -3311,7 +1933,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 ( @@ -3349,7 +1971,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 ( @@ -3387,7 +2009,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 ( @@ -3425,7 +2047,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 ( @@ -3463,7 +2085,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 ( @@ -3500,7 +2122,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 ( @@ -3508,13 +2130,13 @@ CREATE TABLE public.prices ( price_cents integer NOT NULL, valid_from timestamp without time zone, valid_to timestamp without time zone, + updator_str character varying, + creator_str character varying, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, duration interval, operation_category character varying, - zone_id integer NOT NULL, - updator_str character varying, - creator_str character varying + zone_id integer NOT NULL ); @@ -3538,7 +2160,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 ( @@ -3580,7 +2202,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 ( @@ -3616,7 +2238,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 ( @@ -3671,7 +2293,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 ( @@ -3706,7 +2328,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 ( @@ -3715,7 +2337,7 @@ CREATE TABLE public.schema_migrations ( -- --- Name: setting_entries; Type: TABLE; Schema: public; Owner: - +-- Name: setting_entries; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.setting_entries ( @@ -3751,7 +2373,7 @@ ALTER SEQUENCE public.setting_entries_id_seq OWNED BY public.setting_entries.id; -- --- Name: settings; Type: TABLE; Schema: public; Owner: - +-- Name: settings; Type: TABLE; Schema: public; Owner: -; Tablespace: -- CREATE TABLE public.settings ( @@ -3787,7 +2409,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 ( @@ -3815,9 +2437,7 @@ CREATE TABLE public.users ( remember_created_at timestamp without time zone, failed_attempts integer DEFAULT 0 NOT NULL, locked_at timestamp without time zone, - legacy_id integer, - provider character varying, - uid character varying + legacy_id integer ); @@ -3841,7 +2461,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 ( @@ -3876,7 +2496,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 ( @@ -3912,7 +2532,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 ( @@ -3947,7 +2567,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 ( @@ -3990,420 +2610,266 @@ ALTER SEQUENCE public.zones_id_seq OWNED BY public.zones.id; -- --- Name: account_activities id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.account_activities ALTER COLUMN id SET DEFAULT nextval('audit.account_activities_id_seq'::regclass); - - --- --- Name: accounts id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.accounts ALTER COLUMN id SET DEFAULT nextval('audit.accounts_id_seq'::regclass); - - --- --- Name: actions id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.actions ALTER COLUMN id SET DEFAULT nextval('audit.actions_id_seq'::regclass); - - --- --- Name: bank_statements id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.bank_statements ALTER COLUMN id SET DEFAULT nextval('audit.bank_statements_id_seq'::regclass); - - --- --- Name: bank_transactions id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.bank_transactions ALTER COLUMN id SET DEFAULT nextval('audit.bank_transactions_id_seq'::regclass); - - --- --- Name: blocked_domains id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.blocked_domains ALTER COLUMN id SET DEFAULT nextval('audit.blocked_domains_id_seq'::regclass); - - --- --- Name: certificates id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.certificates ALTER COLUMN id SET DEFAULT nextval('audit.certificates_id_seq'::regclass); - - --- --- 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: dnskeys id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.dnskeys ALTER COLUMN id SET DEFAULT nextval('audit.dnskeys_id_seq'::regclass); - - --- --- Name: domain_contacts id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.domain_contacts ALTER COLUMN id SET DEFAULT nextval('audit.domain_contacts_id_seq'::regclass); - - --- --- Name: domains id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.domains ALTER COLUMN id SET DEFAULT nextval('audit.domains_id_seq'::regclass); - - --- --- Name: invoice_items id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.invoice_items ALTER COLUMN id SET DEFAULT nextval('audit.invoice_items_id_seq'::regclass); - - --- --- Name: invoices id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.invoices ALTER COLUMN id SET DEFAULT nextval('audit.invoices_id_seq'::regclass); - - --- --- Name: nameservers id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.nameservers ALTER COLUMN id SET DEFAULT nextval('audit.nameservers_id_seq'::regclass); - - --- --- Name: notifications id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.notifications ALTER COLUMN id SET DEFAULT nextval('audit.notifications_id_seq'::regclass); - - --- --- Name: payment_orders id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.payment_orders ALTER COLUMN id SET DEFAULT nextval('audit.payment_orders_id_seq'::regclass); - - --- --- Name: registrant_verifications id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.registrant_verifications ALTER COLUMN id SET DEFAULT nextval('audit.registrant_verifications_id_seq'::regclass); - - --- --- Name: registrars id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.registrars ALTER COLUMN id SET DEFAULT nextval('audit.registrars_id_seq'::regclass); - - --- --- Name: reserved_domains id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.reserved_domains ALTER COLUMN id SET DEFAULT nextval('audit.reserved_domains_id_seq'::regclass); - - --- --- Name: settings id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.settings ALTER COLUMN id SET DEFAULT nextval('audit.settings_id_seq'::regclass); - - --- --- Name: users id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.users ALTER COLUMN id SET DEFAULT nextval('audit.users_id_seq'::regclass); - - --- --- Name: white_ips id; Type: DEFAULT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.white_ips ALTER COLUMN id SET DEFAULT nextval('audit.white_ips_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: email_address_verifications id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_address_verifications ALTER COLUMN id SET DEFAULT nextval('public.email_address_verifications_id_seq'::regclass); -- --- Name: email_addresses_validations id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_addresses_validations ALTER COLUMN id SET DEFAULT nextval('public.email_addresses_validations_id_seq'::regclass); -- --- Name: email_addresses_verifications id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.email_addresses_verifications ALTER COLUMN id SET DEFAULT nextval('public.email_addresses_verifications_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); @@ -4424,330 +2890,154 @@ ALTER TABLE ONLY public.log_registrant_verifications ALTER COLUMN id SET DEFAULT -- --- 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_setting_entries id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.log_setting_entries ALTER COLUMN id SET DEFAULT nextval('public.log_setting_entries_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: setting_entries id; Type: DEFAULT; Schema: public; Owner: - +-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- ALTER TABLE ONLY public.setting_entries ALTER COLUMN id SET DEFAULT nextval('public.setting_entries_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: account_activities account_activities_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.account_activities - ADD CONSTRAINT account_activities_pkey PRIMARY KEY (id); - - --- --- Name: accounts accounts_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.accounts - ADD CONSTRAINT accounts_pkey PRIMARY KEY (id); - - --- --- Name: actions actions_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.actions - ADD CONSTRAINT actions_pkey PRIMARY KEY (id); - - --- --- Name: bank_statements bank_statements_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.bank_statements - ADD CONSTRAINT bank_statements_pkey PRIMARY KEY (id); - - --- --- Name: bank_transactions bank_transactions_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.bank_transactions - ADD CONSTRAINT bank_transactions_pkey PRIMARY KEY (id); - - --- --- Name: blocked_domains blocked_domains_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.blocked_domains - ADD CONSTRAINT blocked_domains_pkey PRIMARY KEY (id); - - --- --- Name: certificates certificates_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.certificates - ADD CONSTRAINT certificates_pkey PRIMARY KEY (id); - - --- --- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.contacts - ADD CONSTRAINT contacts_pkey PRIMARY KEY (id); - - --- --- Name: dnskeys dnskeys_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.dnskeys - ADD CONSTRAINT dnskeys_pkey PRIMARY KEY (id); - - --- --- Name: domain_contacts domain_contacts_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.domain_contacts - ADD CONSTRAINT domain_contacts_pkey PRIMARY KEY (id); - - --- --- Name: domains domains_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.domains - ADD CONSTRAINT domains_pkey PRIMARY KEY (id); - - --- --- Name: invoice_items invoice_items_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.invoice_items - ADD CONSTRAINT invoice_items_pkey PRIMARY KEY (id); - - --- --- Name: invoices invoices_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.invoices - ADD CONSTRAINT invoices_pkey PRIMARY KEY (id); - - --- --- Name: nameservers nameservers_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.nameservers - ADD CONSTRAINT nameservers_pkey PRIMARY KEY (id); - - --- --- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.notifications - ADD CONSTRAINT notifications_pkey PRIMARY KEY (id); - - --- --- Name: payment_orders payment_orders_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.payment_orders - ADD CONSTRAINT payment_orders_pkey PRIMARY KEY (id); - - --- --- Name: registrant_verifications registrant_verifications_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.registrant_verifications - ADD CONSTRAINT registrant_verifications_pkey PRIMARY KEY (id); - - --- --- Name: registrars registrars_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.registrars - ADD CONSTRAINT registrars_pkey PRIMARY KEY (id); - - --- --- Name: reserved_domains reserved_domains_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.reserved_domains - ADD CONSTRAINT reserved_domains_pkey PRIMARY KEY (id); - - --- --- Name: settings settings_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.settings - ADD CONSTRAINT settings_pkey PRIMARY KEY (id); - - --- --- Name: users users_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.users - ADD CONSTRAINT users_pkey PRIMARY KEY (id); - - --- --- Name: white_ips white_ips_pkey; Type: CONSTRAINT; Schema: audit; Owner: - --- - -ALTER TABLE ONLY audit.white_ips - ADD CONSTRAINT white_ips_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 @@ -4755,7 +3045,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 @@ -4763,7 +3053,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 @@ -4771,7 +3061,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 @@ -4779,7 +3069,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 @@ -4787,7 +3077,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 @@ -4795,7 +3085,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 @@ -4803,7 +3093,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 @@ -4811,7 +3101,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 @@ -4819,7 +3109,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 @@ -4827,7 +3117,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 @@ -4835,7 +3125,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 @@ -4843,7 +3133,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 @@ -4851,7 +3141,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 @@ -4859,7 +3149,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 @@ -4867,7 +3157,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 @@ -4875,7 +3165,7 @@ ALTER TABLE ONLY public.domains -- --- Name: email_address_verifications email_address_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: email_address_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.email_address_verifications @@ -4883,7 +3173,7 @@ ALTER TABLE ONLY public.email_address_verifications -- --- Name: email_addresses_validations email_addresses_validations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: email_addresses_validations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.email_addresses_validations @@ -4891,7 +3181,7 @@ ALTER TABLE ONLY public.email_addresses_validations -- --- Name: email_addresses_verifications email_addresses_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: email_addresses_verifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.email_addresses_verifications @@ -4899,7 +3189,7 @@ ALTER TABLE ONLY public.email_addresses_verifications -- --- 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 @@ -4907,7 +3197,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 @@ -4915,7 +3205,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 @@ -4923,7 +3213,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 @@ -4931,7 +3221,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 @@ -4939,7 +3229,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 @@ -4947,7 +3237,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 @@ -4955,7 +3245,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 @@ -4963,7 +3253,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 @@ -4971,7 +3261,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 @@ -4979,7 +3269,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 @@ -4987,7 +3277,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 @@ -4995,7 +3285,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 @@ -5003,7 +3293,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 @@ -5011,7 +3301,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 @@ -5019,7 +3309,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 @@ -5027,7 +3317,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 @@ -5035,7 +3325,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 @@ -5043,7 +3333,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 @@ -5051,7 +3341,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 @@ -5075,7 +3365,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 @@ -5083,7 +3373,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 @@ -5091,7 +3381,7 @@ ALTER TABLE ONLY public.log_reserved_domains -- --- Name: log_setting_entries log_setting_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: log_setting_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.log_setting_entries @@ -5099,7 +3389,7 @@ ALTER TABLE ONLY public.log_setting_entries -- --- 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 @@ -5107,7 +3397,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 @@ -5115,7 +3405,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 @@ -5123,7 +3413,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 @@ -5131,7 +3421,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 @@ -5139,7 +3429,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 @@ -5147,7 +3437,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 @@ -5155,7 +3445,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 @@ -5163,7 +3453,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 @@ -5171,7 +3461,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 @@ -5179,7 +3469,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 @@ -5187,7 +3477,7 @@ ALTER TABLE ONLY public.reserved_domains -- --- Name: setting_entries setting_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: setting_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.setting_entries @@ -5195,7 +3485,7 @@ ALTER TABLE ONLY public.setting_entries -- --- Name: settings settings_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.settings @@ -5203,7 +3493,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 @@ -5211,7 +3501,7 @@ ALTER TABLE ONLY public.blocked_domains -- --- Name: domain_contacts uniq_contact_of_type_per_domain; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: uniq_contact_of_type_per_domain; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.domain_contacts @@ -5219,7 +3509,7 @@ ALTER TABLE ONLY public.domain_contacts -- --- 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 @@ -5227,7 +3517,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 @@ -5235,7 +3525,7 @@ ALTER TABLE ONLY public.domains -- --- Name: nameservers uniq_hostname_per_domain; Type: CONSTRAINT; Schema: public; Owner: - +-- Name: uniq_hostname_per_domain; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- ALTER TABLE ONLY public.nameservers @@ -5243,7 +3533,7 @@ ALTER TABLE ONLY public.nameservers -- --- 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 @@ -5251,7 +3541,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 @@ -5259,7 +3549,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 @@ -5267,7 +3557,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 @@ -5275,7 +3565,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 @@ -5283,7 +3573,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 @@ -5291,7 +3581,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 @@ -5299,7 +3589,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 @@ -5307,7 +3597,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 @@ -5315,7 +3605,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 @@ -5323,7 +3613,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 @@ -5331,7 +3621,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 @@ -5339,7 +3629,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 @@ -5347,7 +3637,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 @@ -5355,7 +3645,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 @@ -5363,1113 +3653,616 @@ ALTER TABLE ONLY public.zones -- --- Name: account_activities_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX account_activities_object_id_idx ON audit.account_activities USING btree (object_id); - - --- --- Name: account_activities_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX account_activities_recorded_at_idx ON audit.account_activities USING btree (recorded_at); - - --- --- Name: accounts_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX accounts_object_id_idx ON audit.accounts USING btree (object_id); - - --- --- Name: accounts_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX accounts_recorded_at_idx ON audit.accounts USING btree (recorded_at); - - --- --- Name: actions_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX actions_object_id_idx ON audit.actions USING btree (object_id); - - --- --- Name: actions_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX actions_recorded_at_idx ON audit.actions USING btree (recorded_at); - - --- --- Name: bank_statements_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX bank_statements_object_id_idx ON audit.bank_statements USING btree (object_id); - - --- --- Name: bank_statements_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX bank_statements_recorded_at_idx ON audit.bank_statements USING btree (recorded_at); - - --- --- Name: bank_transactions_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX bank_transactions_object_id_idx ON audit.bank_transactions USING btree (object_id); - - --- --- Name: bank_transactions_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX bank_transactions_recorded_at_idx ON audit.bank_transactions USING btree (recorded_at); - - --- --- Name: blocked_domains_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX blocked_domains_object_id_idx ON audit.blocked_domains USING btree (object_id); - - --- --- Name: blocked_domains_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX blocked_domains_recorded_at_idx ON audit.blocked_domains USING btree (recorded_at); - - --- --- Name: certificates_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX certificates_object_id_idx ON audit.certificates USING btree (object_id); - - --- --- Name: certificates_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX certificates_recorded_at_idx ON audit.certificates USING btree (recorded_at); - - --- --- 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: dnskeys_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX dnskeys_object_id_idx ON audit.dnskeys USING btree (object_id); - - --- --- Name: dnskeys_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX dnskeys_recorded_at_idx ON audit.dnskeys USING btree (recorded_at); - - --- --- Name: domain_contacts_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX domain_contacts_object_id_idx ON audit.domain_contacts USING btree (object_id); - - --- --- Name: domain_contacts_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX domain_contacts_recorded_at_idx ON audit.domain_contacts USING btree (recorded_at); - - --- --- Name: domains_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX domains_object_id_idx ON audit.domains USING btree (object_id); - - --- --- Name: domains_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX domains_recorded_at_idx ON audit.domains USING btree (recorded_at); - - --- --- Name: invoice_items_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX invoice_items_object_id_idx ON audit.invoice_items USING btree (object_id); - - --- --- Name: invoice_items_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX invoice_items_recorded_at_idx ON audit.invoice_items USING btree (recorded_at); - - --- --- Name: invoices_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX invoices_object_id_idx ON audit.invoices USING btree (object_id); - - --- --- Name: invoices_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX invoices_recorded_at_idx ON audit.invoices USING btree (recorded_at); - - --- --- Name: nameservers_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX nameservers_object_id_idx ON audit.nameservers USING btree (object_id); - - --- --- Name: nameservers_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX nameservers_recorded_at_idx ON audit.nameservers USING btree (recorded_at); - - --- --- Name: notifications_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX notifications_object_id_idx ON audit.notifications USING btree (object_id); - - --- --- Name: notifications_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX notifications_recorded_at_idx ON audit.notifications USING btree (recorded_at); - - --- --- Name: payment_orders_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX payment_orders_object_id_idx ON audit.payment_orders USING btree (object_id); - - --- --- Name: payment_orders_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX payment_orders_recorded_at_idx ON audit.payment_orders USING btree (recorded_at); - - --- --- Name: registrant_verifications_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX registrant_verifications_object_id_idx ON audit.registrant_verifications USING btree (object_id); - - --- --- Name: registrant_verifications_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX registrant_verifications_recorded_at_idx ON audit.registrant_verifications USING btree (recorded_at); - - --- --- Name: registrars_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX registrars_object_id_idx ON audit.registrars USING btree (object_id); - - --- --- Name: registrars_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX registrars_recorded_at_idx ON audit.registrars USING btree (recorded_at); - - --- --- Name: reserved_domains_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX reserved_domains_object_id_idx ON audit.reserved_domains USING btree (object_id); - - --- --- Name: reserved_domains_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX reserved_domains_recorded_at_idx ON audit.reserved_domains USING btree (recorded_at); - - --- --- Name: settings_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX settings_object_id_idx ON audit.settings USING btree (object_id); - - --- --- Name: settings_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX settings_recorded_at_idx ON audit.settings USING btree (recorded_at); - - --- --- Name: users_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX users_object_id_idx ON audit.users USING btree (object_id); - - --- --- Name: users_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX users_recorded_at_idx ON audit.users USING btree (recorded_at); - - --- --- Name: white_ips_object_id_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX white_ips_object_id_idx ON audit.white_ips USING btree (object_id); - - --- --- Name: white_ips_recorded_at_idx; Type: INDEX; Schema: audit; Owner: - --- - -CREATE INDEX white_ips_recorded_at_idx ON audit.white_ips 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_email_address_verifications_on_domain; Type: INDEX; Schema: public; Owner: - +-- Name: index_email_address_verifications_on_domain; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_email_address_verifications_on_domain ON public.email_address_verifications USING btree (domain); -- --- Name: index_email_address_verifications_on_email; Type: INDEX; Schema: public; Owner: - --- - -CREATE UNIQUE INDEX index_email_address_verifications_on_email ON public.email_address_verifications USING btree (email); - - --- --- Name: index_email_addresses_validations_on_email; Type: INDEX; Schema: public; Owner: - --- - -CREATE UNIQUE INDEX index_email_addresses_validations_on_email ON public.email_addresses_validations USING btree (email); - - --- --- 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_prices_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX index_log_prices_on_item_type_and_item_id ON public.log_prices USING btree (item_type, item_id); - - --- --- Name: index_log_prices_on_whodunnit; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX index_log_prices_on_whodunnit ON public.log_prices 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_setting_entries_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_setting_entries_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_setting_entries_on_item_type_and_item_id ON public.log_setting_entries USING btree (item_type, item_id); -- --- Name: index_log_setting_entries_on_whodunnit; Type: INDEX; Schema: public; Owner: - +-- Name: index_log_setting_entries_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE INDEX index_log_setting_entries_on_whodunnit ON public.log_setting_entries 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_setting_entries_on_code; Type: INDEX; Schema: public; Owner: - +-- Name: index_setting_entries_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX index_setting_entries_on_code ON public.setting_entries USING btree (code); -- --- 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_provider_and_uid; Type: INDEX; Schema: public; Owner: - --- - -CREATE UNIQUE INDEX index_users_on_provider_and_uid ON public.users USING btree (provider, uid); - - --- --- 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_data_migrations; Type: INDEX; Schema: public; Owner: - +-- Name: unique_data_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: -- CREATE UNIQUE INDEX unique_data_migrations ON public.data_migrations USING btree (version); -- --- 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: account_activities process_account_activity_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_account_activity_audit AFTER INSERT OR DELETE OR UPDATE ON public.account_activities FOR EACH ROW EXECUTE PROCEDURE public.process_account_activity_audit(); - - --- --- Name: accounts process_account_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_account_audit AFTER INSERT OR DELETE OR UPDATE ON public.accounts FOR EACH ROW EXECUTE PROCEDURE public.process_account_audit(); - - --- --- Name: actions process_action_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_action_audit AFTER INSERT OR DELETE OR UPDATE ON public.actions FOR EACH ROW EXECUTE PROCEDURE public.process_action_audit(); - - --- --- Name: bank_statements process_bank_statement_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_bank_statement_audit AFTER INSERT OR DELETE OR UPDATE ON public.bank_statements FOR EACH ROW EXECUTE PROCEDURE public.process_bank_statement_audit(); - - --- --- Name: bank_transactions process_bank_transaction_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_bank_transaction_audit AFTER INSERT OR DELETE OR UPDATE ON public.bank_transactions FOR EACH ROW EXECUTE PROCEDURE public.process_bank_transaction_audit(); - - --- --- Name: blocked_domains process_blocked_domain_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_blocked_domain_audit AFTER INSERT OR DELETE OR UPDATE ON public.blocked_domains FOR EACH ROW EXECUTE PROCEDURE public.process_blocked_domain_audit(); - - --- --- Name: certificates process_certificate_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_certificate_audit AFTER INSERT OR DELETE OR UPDATE ON public.certificates FOR EACH ROW EXECUTE PROCEDURE public.process_certificate_audit(); - - --- --- 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: dnskeys process_dnskey_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_dnskey_audit AFTER INSERT OR DELETE OR UPDATE ON public.dnskeys FOR EACH ROW EXECUTE PROCEDURE public.process_dnskey_audit(); - - --- --- Name: domains process_domain_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_domain_audit AFTER INSERT OR DELETE OR UPDATE ON public.domains FOR EACH ROW EXECUTE PROCEDURE public.process_domain_audit(); - - --- --- Name: domain_contacts process_domain_contact_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_domain_contact_audit AFTER INSERT OR DELETE OR UPDATE ON public.domain_contacts FOR EACH ROW EXECUTE PROCEDURE public.process_domain_contact_audit(); - - --- --- Name: invoices process_invoice_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_invoice_audit AFTER INSERT OR DELETE OR UPDATE ON public.invoices FOR EACH ROW EXECUTE PROCEDURE public.process_invoice_audit(); - - --- --- Name: invoice_items process_invoice_item_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_invoice_item_audit AFTER INSERT OR DELETE OR UPDATE ON public.invoice_items FOR EACH ROW EXECUTE PROCEDURE public.process_invoice_item_audit(); - - --- --- Name: nameservers process_nameserver_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_nameserver_audit AFTER INSERT OR DELETE OR UPDATE ON public.nameservers FOR EACH ROW EXECUTE PROCEDURE public.process_nameserver_audit(); - - --- --- Name: notifications process_notification_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_notification_audit AFTER INSERT OR DELETE OR UPDATE ON public.notifications FOR EACH ROW EXECUTE PROCEDURE public.process_notification_audit(); - - --- --- Name: payment_orders process_payment_order_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_payment_order_audit AFTER INSERT OR DELETE OR UPDATE ON public.payment_orders FOR EACH ROW EXECUTE PROCEDURE public.process_payment_order_audit(); - - --- --- Name: registrant_verifications process_registrant_verification_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_registrant_verification_audit AFTER INSERT OR DELETE OR UPDATE ON public.registrant_verifications FOR EACH ROW EXECUTE PROCEDURE public.process_registrant_verification_audit(); - - --- --- Name: registrars process_registrar_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_registrar_audit AFTER INSERT OR DELETE OR UPDATE ON public.registrars FOR EACH ROW EXECUTE PROCEDURE public.process_registrar_audit(); - - --- --- Name: reserved_domains process_reserved_domain_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_reserved_domain_audit AFTER INSERT OR DELETE OR UPDATE ON public.reserved_domains FOR EACH ROW EXECUTE PROCEDURE public.process_reserved_domain_audit(); - - --- --- Name: settings process_setting_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_setting_audit AFTER INSERT OR DELETE OR UPDATE ON public.settings FOR EACH ROW EXECUTE PROCEDURE public.process_setting_audit(); - - --- --- Name: users process_user_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_user_audit AFTER INSERT OR DELETE OR UPDATE ON public.users FOR EACH ROW EXECUTE PROCEDURE public.process_user_audit(); - - --- --- Name: white_ips process_white_ip_audit; Type: TRIGGER; Schema: public; Owner: - --- - -CREATE TRIGGER process_white_ip_audit AFTER INSERT OR DELETE OR UPDATE ON public.white_ips FOR EACH ROW EXECUTE PROCEDURE public.process_white_ip_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 @@ -6477,7 +4270,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 @@ -6485,7 +4278,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 @@ -6493,7 +4286,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 @@ -6501,7 +4294,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 @@ -6509,7 +4302,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 @@ -6517,7 +4310,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 @@ -6525,7 +4318,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 @@ -6533,7 +4326,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 @@ -6541,7 +4334,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 @@ -6549,7 +4342,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 @@ -6557,7 +4350,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 @@ -6565,7 +4358,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 @@ -6573,7 +4366,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 @@ -6581,7 +4374,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 @@ -6589,7 +4382,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 @@ -6597,7 +4390,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 @@ -6605,7 +4398,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 @@ -6613,7 +4406,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 @@ -6621,7 +4414,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 @@ -6629,7 +4422,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 @@ -6637,7 +4430,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 @@ -6645,7 +4438,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 @@ -6653,7 +4446,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 @@ -6661,7 +4454,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 @@ -6669,7 +4462,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 @@ -7095,14 +4888,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200130092113'), ('20200203143458'), ('20200204103125'), -('20200310105731'), -('20200310105736'), ('20200311114649'), -('20200319082650'), -('20200320090152'), -('20200320094842'), -('20200330111918'), -('20200408091005'), ('20200417075720'), ('20200421093637'), ('20200505103316'), @@ -7111,7 +4897,6 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200529115011'), ('20200605100827'), ('20200610090110'), -('20200622080240'), ('20200630081231'), ('20200714115338'), ('20200807110611'), @@ -7121,7 +4906,5 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200902131603'), ('20200908131554'), ('20200910085157'), -('20200910102028'), -('20200915073245'); - +('20200910102028'); From 6e99521d59a95ea3c4f7c6b6302d24e616352888 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 30 Sep 2020 13:33:45 +0500 Subject: [PATCH 11/16] Fix mess with registrant user routes --- app/models/api_user.rb | 2 +- app/models/registrant_user.rb | 2 +- app/models/user.rb | 1 - config/initializers/devise.rb | 8 +- config/routes.rb | 12 +-- .../strategies/id_card_authenticatable.rb | 84 +++++++++---------- 6 files changed, 54 insertions(+), 55 deletions(-) diff --git a/app/models/api_user.rb b/app/models/api_user.rb index 12096bae7..8159137a3 100644 --- a/app/models/api_user.rb +++ b/app/models/api_user.rb @@ -2,7 +2,7 @@ require 'open3' class ApiUser < User include EppErrors - devise :database_authenticatable, :trackable, :timeoutable, #:id_card_authenticatable, + devise :database_authenticatable, :trackable, :timeoutable, authentication_keys: [:username] def epp_code_map diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index efe5dd782..e7ce9cc3b 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -1,7 +1,7 @@ class RegistrantUser < User attr_accessor :idc_data - devise :trackable, :timeoutable + devise :trackable, :timeoutable, :id_card_authenticatable def ability @ability ||= Ability.new(self) diff --git a/app/models/user.rb b/app/models/user.rb index b28c16304..8d043d1ab 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,5 +21,4 @@ class User < ApplicationRecord User.find_by(identity_code: identity_code, country_code: country_code) end - end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 3c1a9015c..dee2824a4 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -281,9 +281,9 @@ Devise.setup do |config| # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' - # require 'devise/models/id_card_authenticatable' - # require 'devise/strategies/id_card_authenticatable' + require 'devise/models/id_card_authenticatable' + require 'devise/strategies/id_card_authenticatable' - # routes = [nil, :new, :destroy] - # config.add_module :id_card_authenticatable, strategy: true, route: { session: routes } + routes = [nil, :new, :destroy] + config.add_module :id_card_authenticatable, strategy: true, route: { session: routes } end diff --git a/config/routes.rb b/config/routes.rb index 04f12694e..8628210c4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,14 +77,14 @@ Rails.application.routes.draw do devise_for :users, path: '', class_name: 'ApiUser', skip: %i[sessions] devise_scope :registrar_user do - # get 'login/mid' => 'sessions#login_mid' - # post 'login/mid' => 'sessions#mid' - # post 'login/mid_status' => 'sessions#mid_status' + get 'login/mid' => 'sessions#login_mid' + post 'login/mid' => 'sessions#mid' + post 'login/mid_status' => 'sessions#mid_status' # /registrar/id path is hardcoded in Apache config for authentication with Estonian ID-card - # post 'id' => 'sessions#id_card', as: :id_card_sign_in - # - # post 'mid' => 'sessions#mid' + post 'id' => 'sessions#id_card', as: :id_card_sign_in + + post 'mid' => 'sessions#mid' match '/open_id/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback match '/open_id/cancel', via: %i[get post delete], to: 'tara#cancel', diff --git a/lib/devise/strategies/id_card_authenticatable.rb b/lib/devise/strategies/id_card_authenticatable.rb index 5ee6bf75d..6c3a7ac92 100644 --- a/lib/devise/strategies/id_card_authenticatable.rb +++ b/lib/devise/strategies/id_card_authenticatable.rb @@ -1,49 +1,49 @@ module Devise module Strategies class IdCardAuthenticatable < Devise::Strategies::Authenticatable - # def valid? - # env['SSL_CLIENT_S_DN_CN'].present? - # end - # - # def authenticate! - # resource = mapping.to - # user = resource.find_by_id_card(id_card) - # - # if user - # success!(user) - # else - # fail - # end - # end - # - # private - # - # def id_card - # id_card = IdCard.new - # id_card.first_name = first_name - # id_card.last_name = last_name - # id_card.personal_code = personal_code - # id_card.country_code = country_code - # id_card - # end - # - # def first_name - # env['SSL_CLIENT_S_DN_CN'].split(',').second.force_encoding('utf-8') - # end - # - # def last_name - # env['SSL_CLIENT_S_DN_CN'].split(',').first.force_encoding('utf-8') - # end - # - # def personal_code - # env['SSL_CLIENT_S_DN_CN'].split(',').last - # end - # - # def country_code - # env['SSL_CLIENT_I_DN_C'] - # end + def valid? + env['SSL_CLIENT_S_DN_CN'].present? + end + + def authenticate! + resource = mapping.to + user = resource.find_by_id_card(id_card) + + if user + success!(user) + else + fail + end + end + + private + + def id_card + id_card = IdCard.new + id_card.first_name = first_name + id_card.last_name = last_name + id_card.personal_code = personal_code + id_card.country_code = country_code + id_card + end + + def first_name + env['SSL_CLIENT_S_DN_CN'].split(',').second.force_encoding('utf-8') + end + + def last_name + env['SSL_CLIENT_S_DN_CN'].split(',').first.force_encoding('utf-8') + end + + def personal_code + env['SSL_CLIENT_S_DN_CN'].split(',').last + end + + def country_code + env['SSL_CLIENT_I_DN_C'] + end end end end -# Warden::Strategies.add(:id_card_authenticatable, Devise::Strategies::IdCardAuthenticatable) +Warden::Strategies.add(:id_card_authenticatable, Devise::Strategies::IdCardAuthenticatable) From 6c24eff1ef6fd8a5aac4c361a51543b687fe9fa8 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 30 Sep 2020 13:47:43 +0500 Subject: [PATCH 12/16] Remove unused tests --- app/controllers/registrar/tara_controller.rb | 2 +- .../registrar_area/sign_in/id_card_test.rb | 124 +++++++++--------- .../registrar_area/sign_in/mobile_id_test.rb | 62 ++++----- 3 files changed, 94 insertions(+), 94 deletions(-) diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb index 31c812c73..9107e46ce 100644 --- a/app/controllers/registrar/tara_controller.rb +++ b/app/controllers/registrar/tara_controller.rb @@ -6,7 +6,7 @@ class Registrar session[:omniauth_hash] = user_hash @api_user = ApiUser.from_omniauth(user_hash) - return unless @api_user.persisted? + return unless @api_user sign_in_and_redirect(:registrar_user, @api_user) end diff --git a/test/integration/registrar_area/sign_in/id_card_test.rb b/test/integration/registrar_area/sign_in/id_card_test.rb index 1441c90ca..a8ab31da0 100644 --- a/test/integration/registrar_area/sign_in/id_card_test.rb +++ b/test/integration/registrar_area/sign_in/id_card_test.rb @@ -1,65 +1,65 @@ require 'test_helper' class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest - setup do - @user = users(:api_bestnames) - @original_registrar_area_ip_whitelist = Setting.registrar_ip_whitelist_enabled - end - - teardown do - Setting.registrar_ip_whitelist_enabled = @original_registrar_area_ip_whitelist - end - - def test_signs_in_a_user_when_id_card_owner_is_found - assert_equal '1234', @user.identity_code - - post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234' } - follow_redirect! - - assert_response :ok - assert_equal registrar_root_path, path - assert_not_nil controller.current_registrar_user - end - - def test_does_not_sign_in_a_user_when_id_card_owner_is_not_found - post registrar_id_card_sign_in_path, - headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,unacceptable-personal-code' } - - assert_nil controller.current_registrar_user - assert_equal registrar_id_card_sign_in_path, path - assert_includes response.body, 'Failed to Login' - end - - def test_does_not_sign_in_a_user_when_id_card_owner_is_found_but_ip_is_not_allowed - allow_access_to_sign_in_page - assert_equal '127.0.0.1', white_ips(:one).ipv4 - assert_equal '1234', @user.identity_code - - Setting.registrar_ip_whitelist_enabled = true - - post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234', - 'REMOTE_ADDR' => '127.0.0.2' } - - assert_equal registrar_id_card_sign_in_path, path - assert_equal 'Access denied from IP 127.0.0.2', response.body - - get registrar_root_path - assert_redirected_to new_registrar_user_session_path - end - - def test_does_not_sign_in_a_user_when_certificate_is_absent - post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => '' } - - assert_nil controller.current_registrar_user - assert_equal registrar_id_card_sign_in_path, path - end - - private - - def allow_access_to_sign_in_page - another_registrar_white_ip = white_ips(:one).dup - another_registrar_white_ip.ipv4 = '127.0.0.2' - another_registrar_white_ip.registrar = registrars(:goodnames) - another_registrar_white_ip.save! - end -end \ No newline at end of file + # setup do + # @user = users(:api_bestnames) + # @original_registrar_area_ip_whitelist = Setting.registrar_ip_whitelist_enabled + # end + # + # teardown do + # Setting.registrar_ip_whitelist_enabled = @original_registrar_area_ip_whitelist + # end + # + # def test_signs_in_a_user_when_id_card_owner_is_found + # assert_equal '1234', @user.identity_code + # + # post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234' } + # follow_redirect! + # + # assert_response :ok + # assert_equal registrar_root_path, path + # assert_not_nil controller.current_registrar_user + # end + # + # def test_does_not_sign_in_a_user_when_id_card_owner_is_not_found + # post registrar_id_card_sign_in_path, + # headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,unacceptable-personal-code' } + # + # assert_nil controller.current_registrar_user + # assert_equal registrar_id_card_sign_in_path, path + # assert_includes response.body, 'Failed to Login' + # end + # + # def test_does_not_sign_in_a_user_when_id_card_owner_is_found_but_ip_is_not_allowed + # allow_access_to_sign_in_page + # assert_equal '127.0.0.1', white_ips(:one).ipv4 + # assert_equal '1234', @user.identity_code + # + # Setting.registrar_ip_whitelist_enabled = true + # + # post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234', + # 'REMOTE_ADDR' => '127.0.0.2' } + # + # assert_equal registrar_id_card_sign_in_path, path + # assert_equal 'Access denied from IP 127.0.0.2', response.body + # + # get registrar_root_path + # assert_redirected_to new_registrar_user_session_path + # end + # + # def test_does_not_sign_in_a_user_when_certificate_is_absent + # post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => '' } + # + # assert_nil controller.current_registrar_user + # assert_equal registrar_id_card_sign_in_path, path + # end + # + # private + # + # def allow_access_to_sign_in_page + # another_registrar_white_ip = white_ips(:one).dup + # another_registrar_white_ip.ipv4 = '127.0.0.2' + # another_registrar_white_ip.registrar = registrars(:goodnames) + # another_registrar_white_ip.save! + # end +end diff --git a/test/system/registrar_area/sign_in/mobile_id_test.rb b/test/system/registrar_area/sign_in/mobile_id_test.rb index 171172b2c..fa3a6117c 100644 --- a/test/system/registrar_area/sign_in/mobile_id_test.rb +++ b/test/system/registrar_area/sign_in/mobile_id_test.rb @@ -1,35 +1,35 @@ require 'application_system_test_case' class RegistrarAreaMobileIDSignInTest < JavaScriptApplicationSystemTestCase - def setup - super - WebMock.allow_net_connect! - - @user = users(:api_bestnames) - @user.identity_code = '1234' - @user.save - end - - def test_valid_phone_number - mock_client = Minitest::Mock.new - mock_client.expect(:authenticate, - OpenStruct.new(user_id_code: '1234', challenge_id: '1234'), - [{ phone: "+3721234", - message_to_display: "Authenticating", - service_name: "Testimine" }]) - mock_client.expect(:session_code, 1234) - - Digidoc::Client.stub(:new, mock_client) do - visit new_registrar_user_session_path - - click_on 'login-with-mobile-id-btn' - - fill_in 'user[phone]', with: '1234' - click_button 'Login' - - flash_message = page.find('div.bg-success') - assert_equal('Confirmation sms was sent to your phone. Verification code is 1234.', - flash_message.text) - end - end + # def setup + # super + # WebMock.allow_net_connect! + # + # @user = users(:api_bestnames) + # @user.identity_code = '1234' + # @user.save + # end + # + # def test_valid_phone_number + # mock_client = Minitest::Mock.new + # mock_client.expect(:authenticate, + # OpenStruct.new(user_id_code: '1234', challenge_id: '1234'), + # [{ phone: "+3721234", + # message_to_display: "Authenticating", + # service_name: "Testimine" }]) + # mock_client.expect(:session_code, 1234) + # + # Digidoc::Client.stub(:new, mock_client) do + # visit new_registrar_user_session_path + # + # click_on 'login-with-mobile-id-btn' + # + # fill_in 'user[phone]', with: '1234' + # click_button 'Login' + # + # flash_message = page.find('div.bg-success') + # assert_equal('Confirmation sms was sent to your phone. Verification code is 1234.', + # flash_message.text) + # end + # end end From 96c0d09c07bcaf34739fdc90c483d29019f93269 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 30 Sep 2020 15:20:31 +0500 Subject: [PATCH 13/16] Remove country code from Tara user search --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8d043d1ab..21d5f6b46 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -17,8 +17,8 @@ class User < ApplicationRecord def self.from_omniauth(omniauth_hash) uid = omniauth_hash['uid'] identity_code = uid.slice(2..-1) - country_code = uid.slice(0..1) + # country_code = uid.slice(0..1) - User.find_by(identity_code: identity_code, country_code: country_code) + User.find_by(identity_code: identity_code) end end From 42488b4ee87c356459d7cb49945df42d013afe81 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 30 Sep 2020 15:43:55 +0500 Subject: [PATCH 14/16] Add error if no API user found --- app/controllers/registrar/tara_controller.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb index 9107e46ce..84938a777 100644 --- a/app/controllers/registrar/tara_controller.rb +++ b/app/controllers/registrar/tara_controller.rb @@ -2,19 +2,27 @@ class Registrar class TaraController < ApplicationController skip_authorization_check + # rubocop:disable Style/AndOr def callback session[:omniauth_hash] = user_hash @api_user = ApiUser.from_omniauth(user_hash) - return unless @api_user - - sign_in_and_redirect(:registrar_user, @api_user) + if @api_user + sign_in_and_redirect(:registrar_user, @api_user) + else + show_error and return + end end + # rubocop:enable Style/AndOr def cancel redirect_to root_path, notice: t(:sign_in_cancelled) end + def show_error + redirect_to new_registrar_user_session_url, alert: t(:no_such_user) + end + private def user_hash From 40af20ef470efb4ef6cf66e1dc330bd4064f0ef0 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 30 Sep 2020 19:02:33 +0500 Subject: [PATCH 15/16] Add button and description to login page --- app/views/registrar/sessions/new.html.erb | 16 +++++----------- config/locales/registrar/sessions.en.yml | 4 ++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/views/registrar/sessions/new.html.erb b/app/views/registrar/sessions/new.html.erb index 7b90cf3be..2ce0b0f1a 100644 --- a/app/views/registrar/sessions/new.html.erb +++ b/app/views/registrar/sessions/new.html.erb @@ -19,16 +19,10 @@
- <%#= link_to '/registrar/login/mid', id: 'login-with-mobile-id-btn' do %> - <%#= image_tag 'mid.gif' %> - <%# end %> - - <%#= link_to registrar_id_card_sign_in_path, method: :post do %> - <%#= image_tag 'id_card.gif' %> - <%# end %> - - <%= link_to "/auth/tara", method: :post, class: "ui button big primary" do %> - <%= image_tag 'id_card.gif' %> - <% end %> + diff --git a/config/locales/registrar/sessions.en.yml b/config/locales/registrar/sessions.en.yml index 4854edccc..63274d7cd 100644 --- a/config/locales/registrar/sessions.en.yml +++ b/config/locales/registrar/sessions.en.yml @@ -4,6 +4,10 @@ en: new: header_html: Eesti Interneti SA
Registrar Portal submit_btn: Login + sign_in_with_identity_document: "Sign in with identity document" + identity_document_text: | + Sign in using Estonian (incl. e-residents) ID card, mobile ID, + Bank link or other EU citizen's electronic ID supported by EIDAS. login_mid: header: Log in with mobile-id submit_btn: Login From eeffb7ee22e10800beb0f4c575990c9b8843bad1 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 30 Sep 2020 19:18:57 +0500 Subject: [PATCH 16/16] Add tests --- .../registrar/sessions_controller.rb | 96 ------------------- app/controllers/registrar/tara_controller.rb | 1 + app/errors/tampering_detected.rb | 3 - app/models/user.rb | 3 - config/locales/account_activities.en.yml | 2 +- config/locales/en.yml | 2 + config/routes.rb | 9 -- .../registrar_area/sign_in/id_card_test.rb | 65 ------------- .../registrar_area/sign_in/mobile_id_test.rb | 35 ------- .../registrar_area/tara/tara_users_test.rb | 45 +++++++++ 10 files changed, 49 insertions(+), 212 deletions(-) delete mode 100644 app/errors/tampering_detected.rb delete mode 100644 test/integration/registrar_area/sign_in/id_card_test.rb delete mode 100644 test/system/registrar_area/sign_in/mobile_id_test.rb create mode 100644 test/system/registrar_area/tara/tara_users_test.rb diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb index 5bebe5619..2fa69ca90 100644 --- a/app/controllers/registrar/sessions_controller.rb +++ b/app/controllers/registrar/sessions_controller.rb @@ -49,102 +49,6 @@ class Registrar end end - def id_card - self.resource = warden.authenticate!(auth_options) - - restricted_ip = Authorization::RestrictedIP.new(request.ip) - ip_allowed = restricted_ip.can_access_registrar_area?(resource.registrar) - - unless ip_allowed - render plain: t('registrar.authorization.ip_not_allowed', ip: request.ip) - warden.logout(:registrar_user) - return - end - - set_flash_message!(:notice, :signed_in) - sign_in(resource_name, resource) - yield resource if block_given? - respond_with resource, location: after_sign_in_path_for(resource) - end - - def login_mid - @user = User.new - end - - def mid - phone = params[:user][:phone] - endpoint = "#{ENV['sk_digi_doc_service_endpoint']}" - client = Digidoc::Client.new(endpoint) - client.logger = Rails.application.config.logger unless Rails.env.test? - - # country_codes = {'+372' => 'EST'} - phone.gsub!('+372', '') - response = client.authenticate( - phone: "+372#{phone}", - message_to_display: 'Authenticating', - service_name: ENV['sk_digi_doc_service_name'] || 'Testing' - ) - - if response.faultcode - render json: { message: response.detail.message }, status: :unauthorized - return - end - - if Setting.registrar_ip_whitelist_enabled - @user = find_user_by_idc_and_allowed(response.user_id_code) - else - @user = find_user_by_idc(response.user_id_code) - end - - if @user.persisted? - session[:user_id_code] = response.user_id_code - session[:mid_session_code] = client.session_code - - render json: { - message: t(:confirmation_sms_was_sent_to_your_phone_verification_code_is, { code: response.challenge_id }) - }, status: :ok - else - render json: { message: t(:no_such_user) }, status: :unauthorized - end - end - - def mid_status - endpoint = "#{ENV['sk_digi_doc_service_endpoint']}" - client = Digidoc::Client.new(endpoint) - client.logger = Rails.application.config.logger unless Rails.env.test? - client.session_code = session[:mid_session_code] - auth_status = client.authentication_status - - case auth_status.status - when 'OUTSTANDING_TRANSACTION' - render json: { message: t(:check_your_phone_for_confirmation_code) }, status: :ok - when 'USER_AUTHENTICATED' - @user = find_user_by_idc_and_allowed(session[:user_id_code]) - sign_in(:registrar_user, @user) - flash[:notice] = t(:welcome) - flash.keep(:notice) - render js: "window.location = '#{after_sign_in_path_for(@user)}'" - when 'NOT_VALID' - render json: { message: t(:user_signature_is_invalid) }, status: :bad_request - when 'EXPIRED_TRANSACTION' - render json: { message: t(:session_timeout) }, status: :bad_request - when 'USER_CANCEL' - render json: { message: t(:user_cancelled) }, status: :bad_request - when 'MID_NOT_READY' - render json: { message: t(:mid_not_ready) }, status: :bad_request - when 'PHONE_ABSENT' - render json: { message: t(:phone_absent) }, status: :bad_request - when 'SENDING_ERROR' - render json: { message: t(:sending_error) }, status: :bad_request - when 'SIM_ERROR' - render json: { message: t(:sim_error) }, status: :bad_request - when 'INTERNAL_ERROR' - render json: { message: t(:internal_error) }, status: :bad_request - else - render json: { message: t(:internal_error) }, status: :bad_request - end - end - private def depp_controller? diff --git a/app/controllers/registrar/tara_controller.rb b/app/controllers/registrar/tara_controller.rb index 84938a777..e02aa52a5 100644 --- a/app/controllers/registrar/tara_controller.rb +++ b/app/controllers/registrar/tara_controller.rb @@ -8,6 +8,7 @@ class Registrar @api_user = ApiUser.from_omniauth(user_hash) if @api_user + flash[:notice] = t(:signed_in_successfully) sign_in_and_redirect(:registrar_user, @api_user) else show_error and return diff --git a/app/errors/tampering_detected.rb b/app/errors/tampering_detected.rb deleted file mode 100644 index 1cf72ba58..000000000 --- a/app/errors/tampering_detected.rb +++ /dev/null @@ -1,3 +0,0 @@ -module Errors - class TamperingDetected < ActionController::BadRequest; end -end diff --git a/app/models/user.rb b/app/models/user.rb index 21d5f6b46..e1b98f3a6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,9 +1,6 @@ class User < ApplicationRecord include Versions # version/user_version.rb - ESTONIAN_COUNTRY_CODE = 'EE'.freeze - TARA_PROVIDER = 'tara'.freeze - has_many :actions, dependent: :restrict_with_exception attr_accessor :phone diff --git a/config/locales/account_activities.en.yml b/config/locales/account_activities.en.yml index 41863219f..648549f8f 100644 --- a/config/locales/account_activities.en.yml +++ b/config/locales/account_activities.en.yml @@ -2,4 +2,4 @@ en: activerecord: attributes: account_activity: - created_at: Receipt date \ No newline at end of file + created_at: Receipt date diff --git a/config/locales/en.yml b/config/locales/en.yml index 398a423f0..8b7b4f0fa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -660,3 +660,5 @@ en: ipv6: IPv6 reference_no: Reference number iban: IBAN + sign_in: "Sign in" + signed_in_successfully: "Signed in successfully" diff --git a/config/routes.rb b/config/routes.rb index 8628210c4..41f857bc8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,15 +77,6 @@ Rails.application.routes.draw do devise_for :users, path: '', class_name: 'ApiUser', skip: %i[sessions] devise_scope :registrar_user do - get 'login/mid' => 'sessions#login_mid' - post 'login/mid' => 'sessions#mid' - post 'login/mid_status' => 'sessions#mid_status' - - # /registrar/id path is hardcoded in Apache config for authentication with Estonian ID-card - post 'id' => 'sessions#id_card', as: :id_card_sign_in - - post 'mid' => 'sessions#mid' - match '/open_id/callback', via: %i[get post], to: 'tara#callback', as: :tara_callback match '/open_id/cancel', via: %i[get post delete], to: 'tara#cancel', as: :tara_cancel diff --git a/test/integration/registrar_area/sign_in/id_card_test.rb b/test/integration/registrar_area/sign_in/id_card_test.rb deleted file mode 100644 index a8ab31da0..000000000 --- a/test/integration/registrar_area/sign_in/id_card_test.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'test_helper' - -class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest - # setup do - # @user = users(:api_bestnames) - # @original_registrar_area_ip_whitelist = Setting.registrar_ip_whitelist_enabled - # end - # - # teardown do - # Setting.registrar_ip_whitelist_enabled = @original_registrar_area_ip_whitelist - # end - # - # def test_signs_in_a_user_when_id_card_owner_is_found - # assert_equal '1234', @user.identity_code - # - # post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234' } - # follow_redirect! - # - # assert_response :ok - # assert_equal registrar_root_path, path - # assert_not_nil controller.current_registrar_user - # end - # - # def test_does_not_sign_in_a_user_when_id_card_owner_is_not_found - # post registrar_id_card_sign_in_path, - # headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,unacceptable-personal-code' } - # - # assert_nil controller.current_registrar_user - # assert_equal registrar_id_card_sign_in_path, path - # assert_includes response.body, 'Failed to Login' - # end - # - # def test_does_not_sign_in_a_user_when_id_card_owner_is_found_but_ip_is_not_allowed - # allow_access_to_sign_in_page - # assert_equal '127.0.0.1', white_ips(:one).ipv4 - # assert_equal '1234', @user.identity_code - # - # Setting.registrar_ip_whitelist_enabled = true - # - # post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234', - # 'REMOTE_ADDR' => '127.0.0.2' } - # - # assert_equal registrar_id_card_sign_in_path, path - # assert_equal 'Access denied from IP 127.0.0.2', response.body - # - # get registrar_root_path - # assert_redirected_to new_registrar_user_session_path - # end - # - # def test_does_not_sign_in_a_user_when_certificate_is_absent - # post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => '' } - # - # assert_nil controller.current_registrar_user - # assert_equal registrar_id_card_sign_in_path, path - # end - # - # private - # - # def allow_access_to_sign_in_page - # another_registrar_white_ip = white_ips(:one).dup - # another_registrar_white_ip.ipv4 = '127.0.0.2' - # another_registrar_white_ip.registrar = registrars(:goodnames) - # another_registrar_white_ip.save! - # end -end diff --git a/test/system/registrar_area/sign_in/mobile_id_test.rb b/test/system/registrar_area/sign_in/mobile_id_test.rb deleted file mode 100644 index fa3a6117c..000000000 --- a/test/system/registrar_area/sign_in/mobile_id_test.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'application_system_test_case' - -class RegistrarAreaMobileIDSignInTest < JavaScriptApplicationSystemTestCase - # def setup - # super - # WebMock.allow_net_connect! - # - # @user = users(:api_bestnames) - # @user.identity_code = '1234' - # @user.save - # end - # - # def test_valid_phone_number - # mock_client = Minitest::Mock.new - # mock_client.expect(:authenticate, - # OpenStruct.new(user_id_code: '1234', challenge_id: '1234'), - # [{ phone: "+3721234", - # message_to_display: "Authenticating", - # service_name: "Testimine" }]) - # mock_client.expect(:session_code, 1234) - # - # Digidoc::Client.stub(:new, mock_client) do - # visit new_registrar_user_session_path - # - # click_on 'login-with-mobile-id-btn' - # - # fill_in 'user[phone]', with: '1234' - # click_button 'Login' - # - # flash_message = page.find('div.bg-success') - # assert_equal('Confirmation sms was sent to your phone. Verification code is 1234.', - # flash_message.text) - # end - # end -end diff --git a/test/system/registrar_area/tara/tara_users_test.rb b/test/system/registrar_area/tara/tara_users_test.rb new file mode 100644 index 000000000..a2defd715 --- /dev/null +++ b/test/system/registrar_area/tara/tara_users_test.rb @@ -0,0 +1,45 @@ +require 'application_system_test_case' + +class TaraUsersTest < ApplicationSystemTestCase + def setup + super + + OmniAuth.config.test_mode = true + @user = users(:api_bestnames) + + @existing_user_hash = { + 'provider' => 'tara', + 'uid' => "EE" + @user.identity_code + } + + @new_user_hash = { + 'provider' => 'tara', + 'uid' => 'EE51007050604' + } + end + + def teardown + super + + OmniAuth.config.test_mode = false + OmniAuth.config.mock_auth['tara'] = nil + end + + def test_existing_user_gets_signed_in + OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@existing_user_hash) + + visit new_registrar_user_session_path + click_link('Sign in') + + assert_text('Signed in successfully') + end + + def test_nonexisting_user_gets_error_message + OmniAuth.config.mock_auth[:tara] = OmniAuth::AuthHash.new(@new_user_hash) + + visit new_registrar_user_session_path + click_link('Sign in') + + assert_text('No such user') + end +end