mirror of
https://github.com/internetee/registry.git
synced 2025-06-04 11:47:30 +02:00
Resolve merge errors
This commit is contained in:
commit
73e9dd6870
817 changed files with 16875 additions and 17443 deletions
|
@ -1,16 +1,15 @@
|
|||
class AddCertCommonName < ActiveRecord::Migration
|
||||
class AddCertCommonName < ActiveRecord::Migration[5.1]
|
||||
def self.up
|
||||
Certificate.all.each do |x|
|
||||
if x.crt.blank? && x.csr.present?
|
||||
pc = x.parsed_csr.try(:subject).try(:to_s) || ''
|
||||
cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||
x.common_name = cn.split('/').first
|
||||
end
|
||||
x.save
|
||||
end
|
||||
# Certificate.all.each do |x|
|
||||
# if x.crt.blank? && x.csr.present?
|
||||
# pc = x.parsed_csr.try(:subject).try(:to_s) || ''
|
||||
# cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||
# x.common_name = cn.split('/').first
|
||||
# end
|
||||
# x.save
|
||||
# end
|
||||
end
|
||||
|
||||
def self.down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
class AddCertMd5 < ActiveRecord::Migration
|
||||
class AddCertMd5 < ActiveRecord::Migration[5.1]
|
||||
def self.up
|
||||
Certificate.all.each do |x|
|
||||
if x.crt.present? && x.csr.present?
|
||||
x.interface = Certificate::REGISTRAR
|
||||
x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
||||
|
||||
pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
||||
cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||
x.common_name = cn.split('/').first
|
||||
elsif x.crt.present? && x.csr.blank?
|
||||
x.interface = Certificate::API
|
||||
x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
||||
|
||||
pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
||||
cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||
x.common_name = cn.split('/').first
|
||||
elsif x.crt.blank? && x.csr.present?
|
||||
x.interface = Certificate::REGISTRAR
|
||||
end
|
||||
x.save
|
||||
end
|
||||
# Certificate.all.each do |x|
|
||||
# if x.crt.present? && x.csr.present?
|
||||
# x.interface = Certificate::REGISTRAR
|
||||
# x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
||||
#
|
||||
# pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
||||
# cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||
# x.common_name = cn.split('/').first
|
||||
# elsif x.crt.present? && x.csr.blank?
|
||||
# x.interface = Certificate::API
|
||||
# x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
||||
#
|
||||
# pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
||||
# cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||
# x.common_name = cn.split('/').first
|
||||
# elsif x.crt.blank? && x.csr.present?
|
||||
# x.interface = Certificate::REGISTRAR
|
||||
# end
|
||||
# x.save
|
||||
# end
|
||||
end
|
||||
|
||||
def self.down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
class AddRenewSetting < ActiveRecord::Migration
|
||||
class AddRenewSetting < ActiveRecord::Migration[5.1]
|
||||
def self.up
|
||||
Setting.days_to_renew_domain_before_expire = 90
|
||||
# Setting.days_to_renew_domain_before_expire = 90
|
||||
end
|
||||
|
||||
def self.down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
class AddExpireSettings < ActiveRecord::Migration
|
||||
class AddExpireSettings < ActiveRecord::Migration[5.1]
|
||||
def self.up
|
||||
Setting.expire_warning_period = 15
|
||||
Setting.redemption_grace_period = 30
|
||||
# Setting.expire_warning_period = 15
|
||||
# Setting.redemption_grace_period = 30
|
||||
end
|
||||
|
||||
def self.down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
class RefactorDomainStatuses < ActiveRecord::Migration
|
||||
class RefactorDomainStatuses < ActiveRecord::Migration[5.1]
|
||||
def self.up
|
||||
Domain.find_each do |x|
|
||||
statuses = []
|
||||
x.domain_statuses.each do |ds|
|
||||
statuses << ds.value
|
||||
end
|
||||
x.update_column('statuses', statuses)
|
||||
end
|
||||
# Domain.find_each do |x|
|
||||
# statuses = []
|
||||
# x.domain_statuses.each do |ds|
|
||||
# statuses << ds.value
|
||||
# end
|
||||
# x.update_column('statuses', statuses) if x.statuses.blank?
|
||||
# end
|
||||
end
|
||||
|
||||
def self.down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
class RefactorContactStatuses < ActiveRecord::Migration
|
||||
class RefactorContactStatuses < ActiveRecord::Migration[5.1]
|
||||
def self.up
|
||||
Contact.find_each do |contact|
|
||||
statuses = []
|
||||
contact.depricated_statuses.each do |ds|
|
||||
statuses << ds.value
|
||||
end
|
||||
contact.update_column('statuses', statuses)
|
||||
end
|
||||
# Contact.find_each do |contact|
|
||||
# statuses = []
|
||||
# contact.depricated_statuses.each do |ds|
|
||||
# statuses << ds.value
|
||||
# end
|
||||
# contact.update_column('statuses', statuses)
|
||||
# end
|
||||
end
|
||||
|
||||
def self.down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
19
db/data/20200225085234_convert_domain_delete_date.rb
Normal file
19
db/data/20200225085234_convert_domain_delete_date.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class ConvertDomainDeleteDate < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
# processed_domain_count = 0
|
||||
#
|
||||
# Domain.transaction do
|
||||
# Domain.find_each do |domain|
|
||||
# next unless domain.delete_date
|
||||
#
|
||||
# domain.update_columns(delete_date: domain.delete_date + 1.day)
|
||||
# processed_domain_count += 1
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# puts "Domains processed: #{processed_domain_count}"
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
class DeleteOrphanedRegistrantVerifications < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
# orphaned_registrant_verifications = RegistrantVerification.where.not(domain_id: Domain.ids)
|
||||
# orphaned_registrant_verification_count = orphaned_registrant_verifications.count
|
||||
# processed_registrant_verification_count = 0
|
||||
#
|
||||
# orphaned_registrant_verifications.each do |registrant_verification|
|
||||
# registrant_verification.destroy!
|
||||
# processed_registrant_verification_count += 1
|
||||
# end
|
||||
#
|
||||
# puts "Processed: #{processed_registrant_verification_count} out of" \
|
||||
# " #{orphaned_registrant_verification_count}"
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
class RegenerateRegistrarReferenceNumbers < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
# processed_registrar_count = 0
|
||||
#
|
||||
# Registrar.transaction do
|
||||
# Registrar.all.each do |registrar|
|
||||
# next unless registrar.reference_no.start_with?('RF')
|
||||
#
|
||||
# registrar.update_columns(reference_no: Billing::ReferenceNo.generate)
|
||||
# processed_registrar_count += 1
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# puts "Registrars processed: #{processed_registrar_count}"
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
21
db/data/20200608084321_fill_email_verifications.rb
Normal file
21
db/data/20200608084321_fill_email_verifications.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
class FillEmailVerifications < ActiveRecord::Migration[6.0]
|
||||
include Concerns::EmailVerifable
|
||||
|
||||
def up
|
||||
# registrar_billing_emails = Registrar.pluck(:billing_email).uniq.reject(&:blank?)
|
||||
# registrar_emails = Registrar.pluck(:email).uniq.reject(&:blank?)
|
||||
# contact_emails = Contact.pluck(:email).uniq.reject(&:blank?)
|
||||
#
|
||||
# emails = (contact_emails + registrar_emails + registrar_billing_emails)
|
||||
# emails = emails.map{ |email| punycode_to_unicode(email) }.uniq
|
||||
#
|
||||
# result = emails.map do |email|
|
||||
# { email: email, domain: domain(email) }
|
||||
# end
|
||||
# EmailAddressVerification.import result, batch_size: 500
|
||||
end
|
||||
|
||||
def down
|
||||
EmailAddressVerification.delete_all
|
||||
end
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
class FillSingleCharactedBlockedDomains < ActiveRecord::Migration[6.0]
|
||||
|
||||
DOMAIN_NAMES = %w[a.ee b.ee c.ee d.ee e.ee f.ee g.ee h.ee i.ee j.ee k.ee l.ee m.ee n.ee o.ee
|
||||
p.ee q.ee r.ee s.ee š.ee z.ee ž.ee t.ee u.ee v.ee w.ee õ.ee ä.ee ö.ee ü.ee
|
||||
x.ee y.ee 0.ee 1.ee 2.ee 3.ee 4.ee 5.ee 6.ee 7.ee 8.ee 9.ee].freeze
|
||||
|
||||
def up
|
||||
BlockedDomain.transaction do
|
||||
DOMAIN_NAMES.each do |name|
|
||||
BlockedDomain.find_or_create_by(name: name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
BlockedDomain.transaction do
|
||||
BlockedDomain.by_domain(DOMAIN_NAMES).delete_all
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddLegalDocumentMandatorySetting < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
Setting.create(code: 'legal_document_is_mandatory',
|
||||
value: 'true', format: 'boolean',
|
||||
group: 'domain_validation')
|
||||
end
|
||||
|
||||
def down
|
||||
Setting.find_by(code: 'legal_document_is_mandatory').destroy
|
||||
end
|
||||
end
|
87
db/data/20200812093540_copy_legacy_settings_to_new_model.rb
Normal file
87
db/data/20200812093540_copy_legacy_settings_to_new_model.rb
Normal file
|
@ -0,0 +1,87 @@
|
|||
class CopyLegacySettingsToNewModel < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
validation_group =
|
||||
%w[admin_contacts_min_count admin_contacts_max_count tech_contacts_min_count ns_min_count
|
||||
tech_contacts_max_count orphans_contacts_in_months key_data_allowed dnskeys_min_count
|
||||
dnskeys_max_count nameserver_required expire_pending_confirmation ds_data_allowed
|
||||
legal_document_is_mandatory ns_max_count].freeze
|
||||
|
||||
expiration_group =
|
||||
%w[days_to_renew_domain_before_expire expire_warning_period redemption_grace_period
|
||||
expiration_reminder_mail].freeze
|
||||
|
||||
billing_group =
|
||||
%w[invoice_number_min invoice_number_max directo_monthly_number_min
|
||||
directo_monthly_number_last days_to_keep_invoices_active directo_monthly_number_max
|
||||
days_to_keep_overdue_invoices_active minimum_deposit directo_receipt_payment_term
|
||||
directo_receipt_product_name directo_sales_agent registry_billing_email
|
||||
registry_invoice_contact registry_vat_no registry_vat_prc registry_bank
|
||||
registry_iban registry_swift directo_monthly_number_max registry_bank_code].freeze
|
||||
|
||||
contacts_group =
|
||||
%w[registry_juridical_name registry_reg_no registry_email registry_phone registry_url
|
||||
registry_street registry_city registry_state registry_zip registry_country_code
|
||||
registry_whois_disclaimer].freeze
|
||||
|
||||
integer_vars =
|
||||
%w[admin_contacts_min_count admin_contacts_max_count tech_contacts_min_count
|
||||
tech_contacts_max_count orphans_contacts_in_months ds_digest_type dnskeys_min_count
|
||||
dnskeys_max_count ns_min_count ns_max_count transfer_wait_time invoice_number_min
|
||||
invoice_number_max days_to_keep_invoices_active days_to_keep_overdue_invoices_active
|
||||
days_to_renew_domain_before_expire expire_warning_period redemption_grace_period
|
||||
expire_pending_confirmation dispute_period_in_months].freeze
|
||||
|
||||
float_vars = %w[registry_vat_prc minimum_deposit].freeze
|
||||
|
||||
boolean_vars =
|
||||
%w[
|
||||
ds_data_allowed
|
||||
key_data_allowed
|
||||
client_side_status_editing_enabled
|
||||
registrar_ip_whitelist_enabled
|
||||
api_ip_whitelist_enabled
|
||||
request_confrimation_on_registrant_change_enabled
|
||||
request_confirmation_on_domain_deletion_enabled
|
||||
nameserver_required
|
||||
address_processing
|
||||
legal_document_is_mandatory
|
||||
].freeze
|
||||
|
||||
sql = 'SELECT var, value, created_at, updated_at, creator_str, updator_str FROM' \
|
||||
' settings ORDER BY settings.id ASC'
|
||||
old_settings = ActiveRecord::Base.connection.execute(sql)
|
||||
|
||||
old_settings.each do |origin|
|
||||
next if origin['var'] == 'days_to_keep_business_registry_cache'
|
||||
entry = SettingEntry.find_or_initialize_by(code: origin['var'])
|
||||
entry[:format] = 'string'
|
||||
entry[:format] = 'boolean' if boolean_vars.include? entry.code
|
||||
entry[:format] = 'float' if float_vars.include? entry.code
|
||||
entry[:format] = 'integer' if integer_vars.include? entry.code
|
||||
|
||||
entry[:group] = 'other'
|
||||
entry[:group] = 'domain_validation' if validation_group.include? entry.code
|
||||
entry[:group] = 'domain_expiration' if expiration_group.include? entry.code
|
||||
entry[:group] = 'billing' if billing_group.include? entry.code
|
||||
entry[:group] = 'contacts' if contacts_group.include? entry.code
|
||||
|
||||
%w[value created_at updated_at creator_str updator_str].each do |field|
|
||||
entry[field] = origin[field]
|
||||
next if field != 'value'
|
||||
|
||||
entry.value = origin[field].gsub('--- ', '').strip.gsub("'", '')
|
||||
end
|
||||
|
||||
if entry.save
|
||||
logger.info "Legacy setting '#{entry.code}' successfully migrated to SettingEntry"
|
||||
else
|
||||
logger.error "!!! Failed to migrate setting '#{entry.code}': " \
|
||||
"#{entry.errors.full_messages.join(', ')}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
15
db/data/20200901131427_remove_unused_setting_entries.rb
Normal file
15
db/data/20200901131427_remove_unused_setting_entries.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
class RemoveUnusedSettingEntries < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
unused_fields = %w[eis_iban eis_bank eis_swift eis_invoice_contact ds_data_with_key_allowed]
|
||||
unused_fields.each do |stg|
|
||||
setting = SettingEntry.find_by(code: stg)
|
||||
next unless setting
|
||||
|
||||
setting.destroy
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
2
db/data_schema.rb
Normal file
2
db/data_schema.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
# encoding: UTF-8
|
||||
DataMigrate::Data.define(version: 20200901131427)
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeContactsNameToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :contacts, :name, false
|
||||
end
|
||||
end
|
5
db/migrate/20190811184334_remove_invoices_seller_id.rb
Normal file
5
db/migrate/20190811184334_remove_invoices_seller_id.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class RemoveInvoicesSellerId < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :invoices, :seller_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeInvoicesNumberToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :invoices, :number, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class AddInvoicesNumberUniqConstraint < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<-SQL
|
||||
ALTER TABLE invoices ADD CONSTRAINT unique_number UNIQUE (number)
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
ALTER TABLE invoices DROP CONSTRAINT unique_number
|
||||
SQL
|
||||
end
|
||||
end
|
5
db/migrate/20190811202347_add_invoices_buyer_id_fk.rb
Normal file
5
db/migrate/20190811202347_add_invoices_buyer_id_fk.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddInvoicesBuyerIdFk < ActiveRecord::Migration
|
||||
def change
|
||||
add_foreign_key :invoices, :registrars, column: :buyer_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class ChangeInvoicesRequiredColumnsToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :invoices, :buyer_id, false
|
||||
change_column_null :invoices, :seller_reg_no, false
|
||||
change_column_null :invoices, :seller_bank, false
|
||||
change_column_null :invoices, :seller_swift, false
|
||||
change_column_null :invoices, :seller_country_code, false
|
||||
change_column_null :invoices, :seller_street, false
|
||||
change_column_null :invoices, :seller_city, false
|
||||
change_column_null :invoices, :buyer_reg_no, false
|
||||
change_column_null :invoices, :buyer_country_code, false
|
||||
change_column_null :invoices, :buyer_street, false
|
||||
change_column_null :invoices, :buyer_city, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class ChangeInvoicesRequiredColumnsToNotNullPart2 < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :invoices, :seller_email, false
|
||||
change_column_null :invoices, :seller_contact_name, false
|
||||
change_column_null :invoices, :buyer_email, false
|
||||
end
|
||||
end
|
6
db/migrate/20190917114907_drop_keyrelays.rb
Normal file
6
db/migrate/20190917114907_drop_keyrelays.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class DropKeyrelays < ActiveRecord::Migration
|
||||
def change
|
||||
drop_table :keyrelays
|
||||
drop_table :log_keyrelays
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeReservedDomainsNameToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :reserved_domains, :name, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class AddReservedDomainsNameUniqConstraint < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<-SQL
|
||||
ALTER TABLE reserved_domains ADD CONSTRAINT uniq_reserved_domains_name UNIQUE (name);
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
ALTER TABLE reserved_domains DROP CONSTRAINT uniq_reserved_domains_name;
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeBlockedDomainsNameToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :blocked_domains, :name, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class AddBlockedDomainsNameUniqConstraint < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<-SQL
|
||||
ALTER TABLE blocked_domains ADD CONSTRAINT uniq_blocked_domains_name UNIQUE (name);
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
ALTER TABLE blocked_domains DROP CONSTRAINT uniq_blocked_domains_name;
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveBlockedDomainsNameIndex < ActiveRecord::Migration
|
||||
def change
|
||||
remove_index :blocked_domains, name: 'index_blocked_domains_on_name'
|
||||
end
|
||||
end
|
19
db/migrate/20191004154844_add_constraints.rb
Normal file
19
db/migrate/20191004154844_add_constraints.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class AddConstraints < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :registrant_verifications, :domain_name, false
|
||||
change_column_null :registrant_verifications, :verification_token, false
|
||||
change_column_null :registrant_verifications, :action, false
|
||||
change_column_null :registrant_verifications, :domain_id, false
|
||||
change_column_null :registrant_verifications, :action_type, false
|
||||
add_foreign_key :registrant_verifications, :domains
|
||||
|
||||
change_column_null :zones, :origin, false
|
||||
change_column_null :zones, :ttl, false
|
||||
change_column_null :zones, :refresh, false
|
||||
change_column_null :zones, :retry, false
|
||||
change_column_null :zones, :expire, false
|
||||
change_column_null :zones, :minimum_ttl, false
|
||||
change_column_null :zones, :email, false
|
||||
change_column_null :zones, :master_nameserver, false
|
||||
end
|
||||
end
|
6
db/migrate/20191005162437_add_constraints_part_ii.rb
Normal file
6
db/migrate/20191005162437_add_constraints_part_ii.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddConstraintsPartIi < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :white_ips, :registrar_id, false
|
||||
add_foreign_key :white_ips, :registrars
|
||||
end
|
||||
end
|
7
db/migrate/20191007123000_add_constraints_part_iii.rb
Normal file
7
db/migrate/20191007123000_add_constraints_part_iii.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class AddConstraintsPartIii < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :domains, :name, false
|
||||
change_column_null :domains, :name_puny, false
|
||||
change_column_null :domains, :name_dirty, false
|
||||
end
|
||||
end
|
6
db/migrate/20191008024334_remove_csr_crt_from_users.rb
Normal file
6
db/migrate/20191008024334_remove_csr_crt_from_users.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class RemoveCsrCrtFromUsers < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :users, :csr, :text
|
||||
remove_column :users, :crt, :text
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class AddInvoiceItemsQuantityConstraint < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<~SQL
|
||||
ALTER TABLE invoice_items ADD CONSTRAINT invoice_items_quantity_is_positive
|
||||
CHECK (quantity > 0);
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<~SQL
|
||||
ALTER TABLE invoice_items DROP CONSTRAINT invoice_items_quantity_is_positive;
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class AddInvoicesDueDateConstraint < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<~SQL
|
||||
ALTER TABLE invoices ADD CONSTRAINT invoices_due_date_is_not_before_issue_date
|
||||
CHECK (due_date >= issue_date);
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<~SQL
|
||||
ALTER TABLE invoices DROP CONSTRAINT invoices_due_date_is_not_before_issue_date;
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddForceDeleteStartToDomains < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :domains, :force_delete_start, :datetime
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveRegistrantVerificationsDomainName < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
remove_column :registrant_verifications, :domain_name
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class RemoveFillIdentCountryFunction < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
execute <<~SQL
|
||||
DROP FUNCTION fill_ident_country();
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
class AddJsonBasedVersionToRegistrantVerifications < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
name = 'registrant_verification'
|
||||
table_name = "log_#{name.tableize}"
|
||||
|
||||
create_table table_name do |t|
|
||||
t.string :item_type, null: false
|
||||
t.integer :item_id, null: false
|
||||
t.string :event, null: false
|
||||
t.string :whodunnit
|
||||
t.json :object
|
||||
t.json :object_changes
|
||||
t.datetime :created_at
|
||||
t.string :session
|
||||
end
|
||||
add_index table_name, [:item_type, :item_id]
|
||||
add_index table_name, :whodunnit
|
||||
|
||||
add_column name.tableize, :creator_id_tmp, :integer
|
||||
add_column name.tableize, :updater_id_tmp, :integer
|
||||
rename_column name.tableize, :creator_id_tmp, :creator_id
|
||||
rename_column name.tableize, :updater_id_tmp, :updater_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class AddUuidToLogRegistrantVerification < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
change_table 'log_registrant_verifications' do |t|
|
||||
t.string :uuid
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddForceDeleteDataToDomains < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :domains, :force_delete_data, :hstore
|
||||
end
|
||||
end
|
15
db/migrate/20200130092113_create_payment_orders.rb
Normal file
15
db/migrate/20200130092113_create_payment_orders.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
class CreatePaymentOrders < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :payment_orders do |t|
|
||||
t.string :type, null: false
|
||||
t.string :status, default: 'issued', null: false
|
||||
t.belongs_to :invoice, foreign_key: true
|
||||
t.jsonb :response, null: true
|
||||
t.string :notes, null: true
|
||||
t.string :creator_str
|
||||
t.string :updator_str
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
16
db/migrate/20200203143458_create_payment_order_versions.rb
Normal file
16
db/migrate/20200203143458_create_payment_order_versions.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class CreatePaymentOrderVersions < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :log_payment_orders do |t|
|
||||
t.string :item_type, null: false
|
||||
t.integer :item_id, null: false
|
||||
t.string :event, null: false
|
||||
t.string :whodunnit
|
||||
t.jsonb :object
|
||||
t.jsonb :object_changes
|
||||
t.datetime :created_at
|
||||
t.string :session
|
||||
t.jsonb :children
|
||||
t.string :uuid
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddEInvoiceSentAtToInvoice < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :invoices, :e_invoice_sent_at, :datetime
|
||||
end
|
||||
end
|
247
db/migrate/20200311114649_update_zone_generation_migration.rb
Normal file
247
db/migrate/20200311114649_update_zone_generation_migration.rb
Normal file
|
@ -0,0 +1,247 @@
|
|||
class UpdateZoneGenerationMigration < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
execute <<-SQL
|
||||
CREATE OR REPLACE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
||||
LANGUAGE plpgsql
|
||||
AS $_$
|
||||
DECLARE
|
||||
zone_header text := concat('$ORIGIN ', i_origin, '.');
|
||||
serial_num varchar;
|
||||
include_filter varchar := '';
|
||||
exclude_filter varchar := '';
|
||||
tmp_var text;
|
||||
ret text;
|
||||
BEGIN
|
||||
-- define filters
|
||||
include_filter = '%.' || i_origin;
|
||||
|
||||
-- for %.%.%
|
||||
IF i_origin ~ '.' THEN
|
||||
exclude_filter := '';
|
||||
-- for %.%
|
||||
ELSE
|
||||
exclude_filter := '%.%.' || i_origin;
|
||||
END IF;
|
||||
|
||||
SELECT ROUND(extract(epoch from now() at time zone 'utc')) INTO serial_num;
|
||||
|
||||
-- zonefile header
|
||||
SELECT concat(
|
||||
format('%-10s', '$ORIGIN .'), chr(10),
|
||||
format('%-10s', '$TTL'), zf.ttl, chr(10), chr(10),
|
||||
format('%-10s', i_origin || '.'), 'IN SOA ', zf.master_nameserver, '. ', zf.email, '. (', chr(10),
|
||||
format('%-17s', ''), format('%-12s', serial_num), '; serial number', chr(10),
|
||||
format('%-17s', ''), format('%-12s', zf.refresh), '; refresh, seconds', chr(10),
|
||||
format('%-17s', ''), format('%-12s', zf.retry), '; retry, seconds', chr(10),
|
||||
format('%-17s', ''), format('%-12s', zf.expire), '; expire, seconds', chr(10),
|
||||
format('%-17s', ''), format('%-12s', zf.minimum_ttl), '; minimum TTL, seconds', chr(10),
|
||||
format('%-17s', ''), ')'
|
||||
) FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
|
||||
ret = concat(tmp_var, chr(10), chr(10));
|
||||
|
||||
-- origin ns records
|
||||
SELECT ns_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- ns records
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(d.name_puny, '. IN NS ', coalesce(ns.hostname_puny, ns.hostname), '.')
|
||||
FROM domains d
|
||||
JOIN nameservers ns ON ns.domain_id = d.id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
|
||||
ORDER BY d.name
|
||||
),
|
||||
chr(10)
|
||||
) INTO tmp_var;
|
||||
|
||||
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||
|
||||
-- origin a glue records
|
||||
SELECT a_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- a glue records for other nameservers
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(coalesce(ns.hostname_puny, ns.hostname), '. IN A ', unnest(ns.ipv4))
|
||||
FROM nameservers ns
|
||||
JOIN domains d ON d.id = ns.domain_id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||
AND (ns.hostname LIKE '%.' || d.name) OR (ns.hostname LIKE d.name)
|
||||
AND d.name <> i_origin
|
||||
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> '{}'
|
||||
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
|
||||
), chr(10)
|
||||
) INTO tmp_var;
|
||||
|
||||
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||
|
||||
-- origin aaaa glue records
|
||||
SELECT a4_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- aaaa glue records for other nameservers
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(coalesce(ns.hostname_puny, ns.hostname), '. IN AAAA ', unnest(ns.ipv6))
|
||||
FROM nameservers ns
|
||||
JOIN domains d ON d.id = ns.domain_id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||
AND (ns.hostname LIKE '%.' || d.name) OR (ns.hostname LIKE d.name)
|
||||
AND d.name <> i_origin
|
||||
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> '{}'
|
||||
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
|
||||
), chr(10)
|
||||
) INTO tmp_var;
|
||||
|
||||
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||
|
||||
-- ds records
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(
|
||||
d.name_puny, '. 3600 IN DS ', dk.ds_key_tag, ' ',
|
||||
dk.ds_alg, ' ', dk.ds_digest_type, ' ', dk.ds_digest
|
||||
)
|
||||
FROM domains d
|
||||
JOIN dnskeys dk ON dk.domain_id = d.id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter AND dk.flags = 257
|
||||
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
|
||||
),
|
||||
chr(10)
|
||||
) INTO tmp_var;
|
||||
|
||||
ret := concat(ret, '; Zone DS Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
RETURN ret;
|
||||
END;
|
||||
$_$;
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
CREATE OR REPLACE FUNCTION generate_zonefile(i_origin character varying) RETURNS text
|
||||
LANGUAGE plpgsql
|
||||
AS $_$
|
||||
DECLARE
|
||||
zone_header text := concat('$ORIGIN ', i_origin, '.');
|
||||
serial_num varchar;
|
||||
include_filter varchar := '';
|
||||
exclude_filter varchar := '';
|
||||
tmp_var text;
|
||||
ret text;
|
||||
BEGIN
|
||||
-- define filters
|
||||
include_filter = '%.' || i_origin;
|
||||
|
||||
-- for %.%.%
|
||||
IF i_origin ~ '.' THEN
|
||||
exclude_filter := '';
|
||||
-- for %.%
|
||||
ELSE
|
||||
exclude_filter := '%.%.' || i_origin;
|
||||
END IF;
|
||||
|
||||
SELECT ROUND(extract(epoch from now() at time zone 'utc')) INTO serial_num;
|
||||
|
||||
-- zonefile header
|
||||
SELECT concat(
|
||||
format('%-10s', '$ORIGIN .'), chr(10),
|
||||
format('%-10s', '$TTL'), zf.ttl, chr(10), chr(10),
|
||||
format('%-10s', i_origin || '.'), 'IN SOA ', zf.master_nameserver, '. ', zf.email, '. (', chr(10),
|
||||
format('%-17s', ''), format('%-12s', serial_num), '; serial number', chr(10),
|
||||
format('%-17s', ''), format('%-12s', zf.refresh), '; refresh, seconds', chr(10),
|
||||
format('%-17s', ''), format('%-12s', zf.retry), '; retry, seconds', chr(10),
|
||||
format('%-17s', ''), format('%-12s', zf.expire), '; expire, seconds', chr(10),
|
||||
format('%-17s', ''), format('%-12s', zf.minimum_ttl), '; minimum TTL, seconds', chr(10),
|
||||
format('%-17s', ''), ')'
|
||||
) FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
|
||||
ret = concat(tmp_var, chr(10), chr(10));
|
||||
|
||||
-- origin ns records
|
||||
SELECT ns_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone NS Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- ns records
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(d.name_puny, '. IN NS ', coalesce(ns.hostname_puny, ns.hostname), '.')
|
||||
FROM domains d
|
||||
JOIN nameservers ns ON ns.domain_id = d.id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
|
||||
ORDER BY d.name
|
||||
),
|
||||
chr(10)
|
||||
) INTO tmp_var;
|
||||
|
||||
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||
|
||||
-- origin a glue records
|
||||
SELECT a_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone A Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- a glue records for other nameservers
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(coalesce(ns.hostname_puny, ns.hostname), '. IN A ', unnest(ns.ipv4))
|
||||
FROM nameservers ns
|
||||
JOIN domains d ON d.id = ns.domain_id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||
AND ns.hostname LIKE '%.' || d.name
|
||||
AND d.name <> i_origin
|
||||
AND ns.ipv4 IS NOT NULL AND ns.ipv4 <> '{}'
|
||||
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
|
||||
), chr(10)
|
||||
) INTO tmp_var;
|
||||
|
||||
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||
|
||||
-- origin aaaa glue records
|
||||
SELECT a4_records FROM zones zf WHERE i_origin = zf.origin INTO tmp_var;
|
||||
ret := concat(ret, '; Zone AAAA Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
-- aaaa glue records for other nameservers
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(coalesce(ns.hostname_puny, ns.hostname), '. IN AAAA ', unnest(ns.ipv6))
|
||||
FROM nameservers ns
|
||||
JOIN domains d ON d.id = ns.domain_id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter
|
||||
AND ns.hostname LIKE '%.' || d.name
|
||||
AND d.name <> i_origin
|
||||
AND ns.ipv6 IS NOT NULL AND ns.ipv6 <> '{}'
|
||||
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
|
||||
), chr(10)
|
||||
) INTO tmp_var;
|
||||
|
||||
ret := concat(ret, tmp_var, chr(10), chr(10));
|
||||
|
||||
-- ds records
|
||||
SELECT array_to_string(
|
||||
array(
|
||||
SELECT concat(
|
||||
d.name_puny, '. 3600 IN DS ', dk.ds_key_tag, ' ',
|
||||
dk.ds_alg, ' ', dk.ds_digest_type, ' ', dk.ds_digest
|
||||
)
|
||||
FROM domains d
|
||||
JOIN dnskeys dk ON dk.domain_id = d.id
|
||||
WHERE d.name LIKE include_filter AND d.name NOT LIKE exclude_filter AND dk.flags = 257
|
||||
AND NOT ('{serverHold,clientHold,inactive}' && d.statuses)
|
||||
),
|
||||
chr(10)
|
||||
) INTO tmp_var;
|
||||
|
||||
ret := concat(ret, '; Zone DS Records', chr(10), tmp_var, chr(10));
|
||||
|
||||
RETURN ret;
|
||||
END;
|
||||
$_$;
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddRegistrationDeadlineDateToModels < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :auctions, :registration_deadline, :datetime
|
||||
end
|
||||
end
|
14
db/migrate/20200421093637_create_disputes.rb
Normal file
14
db/migrate/20200421093637_create_disputes.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
class CreateDisputes < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :disputes do |t|
|
||||
t.string :domain_name, null: false
|
||||
t.string :password, null: false
|
||||
t.date :expires_at, null: false
|
||||
t.date :starts_at, null: false
|
||||
t.text :comment
|
||||
t.boolean :closed, null: false, default: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
5
db/migrate/20200505103316_add_revoked_to_certificate.rb
Normal file
5
db/migrate/20200505103316_add_revoked_to_certificate.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddRevokedToCertificate < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :certificates, :revoked, :boolean, null: false, default: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddDisputePeriodInMonthsToSetting < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
Setting.create(var: 'dispute_period_in_months', value: 36)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
class AddClosedDateTimeAndUpdatorToDispute < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
rename_column :disputes, :closed, :closed_boolean
|
||||
add_column :disputes, :closed, :datetime
|
||||
execute 'UPDATE disputes SET closed = updated_at WHERE closed_boolean = true'
|
||||
execute 'UPDATE disputes SET closed = NULL WHERE closed_boolean = false'
|
||||
remove_column :disputes, :closed_boolean
|
||||
add_column :disputes, :initiator, :string
|
||||
end
|
||||
|
||||
def down
|
||||
rename_column :disputes, :closed, :closed_datetime
|
||||
add_column :disputes, :closed, :boolean, null: false, default: false
|
||||
execute 'UPDATE disputes SET closed = true WHERE closed_datetime != NULL'
|
||||
execute 'UPDATE disputes SET closed = false WHERE closed_datetime = NULL'
|
||||
remove_column :disputes, :closed_datetime
|
||||
remove_column :disputes, :initiator
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
# This migration comes from active_storage (originally 20180723000244)
|
||||
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
|
||||
|
||||
if table_exists?(:active_storage_blobs)
|
||||
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class CreateEmailAddressVerifications < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :email_address_verifications do |t|
|
||||
t.string :email, null: false
|
||||
t.datetime :verified_at
|
||||
t.boolean :success, null: false, default: false
|
||||
t.string :domain, null: false
|
||||
end
|
||||
|
||||
add_index :email_address_verifications, :email, unique: true
|
||||
add_index :email_address_verifications, :domain
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class ChangeEmailVerificationFieldsToCitext < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
enable_extension 'citext'
|
||||
change_column :email_address_verifications, :email, :citext
|
||||
change_column :email_address_verifications, :domain, :citext
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :email_address_verifications, :email, :string
|
||||
change_column :email_address_verifications, :domain, :string
|
||||
disable_extension 'citext'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class AddLegalDocOptoutToRegistrar < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :registrars, :legaldoc_optout, :boolean, null: false, default: false
|
||||
add_column :registrars, :legaldoc_optout_comment, :text
|
||||
end
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
class AddUniqueConstraintsToDomainObjects < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
|
||||
execute <<-SQL
|
||||
alter table domain_contacts
|
||||
drop constraint if exists uniq_contact_of_type_per_domain;
|
||||
SQL
|
||||
|
||||
execute <<-SQL
|
||||
alter table nameservers
|
||||
drop constraint if exists uniq_hostname_per_domain;
|
||||
SQL
|
||||
|
||||
execute <<-SQL
|
||||
alter table domain_contacts
|
||||
add constraint uniq_contact_of_type_per_domain unique (domain_id, type, contact_id);
|
||||
SQL
|
||||
|
||||
execute <<-SQL
|
||||
alter table nameservers
|
||||
add constraint uniq_hostname_per_domain unique (domain_id, hostname);
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
alter table domain_contacts
|
||||
drop constraint if exists uniq_contact_of_type_per_domain;
|
||||
SQL
|
||||
|
||||
execute <<-SQL
|
||||
alter table nameservers
|
||||
drop constraint if exists uniq_hostname_per_domain;
|
||||
SQL
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class ChangeRegistrantVerificationCreatorUpdatorIdToString < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :registrant_verifications, :creator_str, :string
|
||||
add_column :registrant_verifications, :updator_str, :string
|
||||
|
||||
remove_column :registrant_verifications, :creator_id
|
||||
remove_column :registrant_verifications, :updater_id
|
||||
end
|
||||
end
|
16
db/migrate/20200811074839_create_setting_entries.rb
Normal file
16
db/migrate/20200811074839_create_setting_entries.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class CreateSettingEntries < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :setting_entries do |t|
|
||||
t.string :code, null: false, index: { unique: true }
|
||||
t.string :value
|
||||
t.string :group, null: false
|
||||
t.string :format, null: false
|
||||
|
||||
# Versioning related
|
||||
t.string :creator_str
|
||||
t.string :updator_str
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeSettingEntryValueToAllowNil < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
change_column :setting_entries, :value, :string, null: true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,26 @@
|
|||
class CreateVersionsForSettingEntries < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
create_table :log_setting_entries, force: :cascade do |t|
|
||||
t.string :item_type, null: false
|
||||
t.integer :item_id, null: false
|
||||
t.string :event, null: false
|
||||
t.string :whodunnit
|
||||
t.json :object
|
||||
t.json :object_changes
|
||||
t.datetime :created_at
|
||||
t.string :session
|
||||
t.json :children
|
||||
t.string :uuid
|
||||
end
|
||||
|
||||
add_index 'log_setting_entries', ['item_type', 'item_id'], name: 'index_log_setting_entries_on_item_type_and_item_id', using: :btree
|
||||
add_index 'log_setting_entries', ['whodunnit'], name: 'index_log_setting_entries_on_whodunnit', using: :btree
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :log_setting_entries, name: 'index_log_setting_entries_on_item_type_and_item_id'
|
||||
remove_index :log_setting_entries, name: 'index_log_setting_entries_on_whodunnit'
|
||||
|
||||
drop_table :log_setting_entries
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
class ChangeLogDomainsChildrenTypeToJsonb < ActiveRecord::Migration
|
||||
class ChangeLogDomainsChildrenTypeToJsonb < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
change_column :log_domains, :children, 'jsonb USING children::jsonb'
|
||||
end
|
||||
end
|
||||
end
|
114
db/seeds.rb
114
db/seeds.rb
|
@ -1,2 +1,116 @@
|
|||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
ActiveRecord::Base.transaction do
|
||||
# Create dynamic Setting objects
|
||||
SettingEntry.create(code: 'registry_vat_prc', value: '0.2', format: 'float', group: 'billing')
|
||||
SettingEntry.create(code: 'directo_sales_agent', value: 'HELEN', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'admin_contacts_min_count', value: '1', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'admin_contacts_max_count', value: '10', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'tech_contacts_min_count', value: '1', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'tech_contacts_max_count', value: '10', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'orphans_contacts_in_months', value: '6', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'ds_data_allowed', value: 'false', format: 'boolean', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'key_data_allowed', value: 'true', format: 'boolean', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'dnskeys_min_count', value: '0', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'dnskeys_max_count', value: '9', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'nameserver_required', value: 'false', format: 'boolean', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'ns_min_count', value: '2', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'ns_max_count', value: '11', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'expire_pending_confirmation', value: '48', format: 'integer', group: 'domain_validation')
|
||||
SettingEntry.create(code: 'days_to_renew_domain_before_expire', value: '90', format: 'integer', group: 'domain_expiration')
|
||||
SettingEntry.create(code: 'expire_warning_period', value: '15', format: 'integer', group: 'domain_expiration')
|
||||
SettingEntry.create(code: 'redemption_grace_period', value: '30', format: 'integer', group: 'domain_expiration')
|
||||
SettingEntry.create(code: 'transfer_wait_time', value: '0', format: 'integer', group: 'other')
|
||||
SettingEntry.create(code: 'ds_digest_type', value: '2', format: 'integer', group: 'other')
|
||||
SettingEntry.create(code: 'client_side_status_editing_enabled', value: 'false', format: 'boolean', group: 'other')
|
||||
SettingEntry.create(code: 'api_ip_whitelist_enabled', value: 'false', format: 'boolean', group: 'other')
|
||||
SettingEntry.create(code: 'registrar_ip_whitelist_enabled', value: 'false', format: 'boolean', group: 'other')
|
||||
SettingEntry.create(code: 'request_confrimation_on_registrant_change_enabled', value: 'true', format: 'boolean', group: 'other')
|
||||
SettingEntry.create(code: 'request_confirmation_on_domain_deletion_enabled', value: 'true', format: 'boolean', group: 'other')
|
||||
SettingEntry.create(code: 'default_language', value: 'en', format: 'string', group: 'other')
|
||||
SettingEntry.create(code: 'invoice_number_min', value: '131050', format: 'integer', group: 'billing')
|
||||
SettingEntry.create(code: 'invoice_number_max', value: '149999', format: 'integer', group: 'billing')
|
||||
SettingEntry.create(code: 'days_to_keep_invoices_active', value: '30', format: 'integer', group: 'billing')
|
||||
SettingEntry.create(code: 'days_to_keep_overdue_invoices_active', value: '0', format: 'integer', group: 'billing')
|
||||
SettingEntry.create(code: 'minimum_deposit', value: '0.0', format: 'float', group: 'billing')
|
||||
SettingEntry.create(code: 'directo_receipt_payment_term', value: 'R', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'directo_receipt_product_name', value: 'ETTEM06', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_billing_email', value: 'info@internet.ee', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_invoice_contact', value: 'Martti Õigus', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_vat_no', value: 'EE101286464', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_bank', value: 'LHV Pank', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_iban', value: 'EE557700771000598731', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_swift', value: 'LHVBEE22', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_email', value: 'info@internet.ee', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'registry_phone', value: '+372 727 1000', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'registry_url', value: 'www.internet.ee', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'registry_street', value: 'Paldiski mnt 80', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'registry_city', value: 'Tallinn', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'registry_state', value: 'Harjumaa', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'registry_country_code', value: 'EE', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'expiration_reminder_mail', value: '2', format: 'integer', group: 'domain_expiration')
|
||||
SettingEntry.create(code: 'directo_monthly_number_min', value: '309901', format: 'integer', group: 'billing')
|
||||
SettingEntry.create(code: 'directo_monthly_number_max', value: '309999', format: 'integer', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_bank_code', value: '689', format: 'string', group: 'billing')
|
||||
SettingEntry.create(code: 'registry_reg_no', value: '90010019', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'registry_zip', value: '10617', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'registry_juridical_name', value: 'Eesti Interneti SA', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'address_processing', value: 'true', format: 'boolean', group: 'other')
|
||||
SettingEntry.create(code: 'directo_monthly_number_last', value: '309901', format: 'integer', group: 'billing')
|
||||
SettingEntry.create(code: 'dispute_period_in_months', value: '36', format: 'integer', group: 'other')
|
||||
SettingEntry.create(code: 'registry_whois_disclaimer', value: 'Search results may not be used for commercial, advertising, recompilation, repackaging, redistribution, reuse, obscuring or other similar activities.', format: 'string', group: 'contacts')
|
||||
SettingEntry.create(code: 'legal_document_is_mandatory', value: 'true', format: 'boolean', group: 'domain_validation')
|
||||
|
||||
AdminUser.where(username: 'admin').first_or_create!(
|
||||
username: 'admin',
|
||||
email: 'admin@domain.tld',
|
||||
password: 'adminadmin',
|
||||
password_confirmation: 'adminadmin',
|
||||
identity_code: '38001085718',
|
||||
country_code: 'EE',
|
||||
roles: ['admin']
|
||||
)
|
||||
|
||||
# First registrar
|
||||
Registrar.where(name: 'Registrar First').first_or_create!(
|
||||
name: 'Registrar First',
|
||||
reg_no: '90010019',
|
||||
accounting_customer_code: '1234',
|
||||
language: 'EE',
|
||||
reference_no: '11',
|
||||
# vat_rate: '0.2',
|
||||
vat_no: 'EE101286464',
|
||||
address_country_code: 'EE',
|
||||
address_state: 'Harjumaa',
|
||||
address_city: 'Tallinn',
|
||||
address_street: 'Tänav 1',
|
||||
address_zip: '1234546',
|
||||
email: 'registrar@first.tld',
|
||||
code: 'REG1'
|
||||
)
|
||||
|
||||
# registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
|
||||
|
||||
# ApiUser.create!(
|
||||
# username: 'api_first',
|
||||
# password: 'api_first',
|
||||
# identity_code: '38001085718',
|
||||
# active: true,
|
||||
# registrar: registrar,
|
||||
# roles: ['epp']
|
||||
# )
|
||||
|
||||
|
||||
|
||||
# ZonefileSetting.create!(
|
||||
# origin: 'tld',
|
||||
# ttl: 43200,
|
||||
# refresh: 3600,
|
||||
# retry: 900,
|
||||
# expire: 1209600,
|
||||
# minimum_ttl: 3600,
|
||||
# email: 'admin.domain.tld',
|
||||
# master_nameserver: 'ns.tld'
|
||||
# )
|
||||
end
|
||||
|
|
2179
db/structure.sql
2179
db/structure.sql
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,3 @@
|
|||
# encoding: UTF-8
|
||||
# This file is auto-generated from the current state of the database. Instead
|
||||
# of editing this file, please use the migrations feature of Active Record to
|
||||
# incrementally modify your database, and then regenerate this schema definition.
|
||||
|
@ -11,41 +10,33 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20181102124618) do
|
||||
ActiveRecord::Schema.define(version: 2018_11_02_124618) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "ar_internal_metadata", primary_key: "key", force: :cascade do |t|
|
||||
t.string "value"
|
||||
create_table "contact_requests", force: :cascade do |t|
|
||||
t.integer "whois_record_id", null: false
|
||||
t.string "secret", null: false
|
||||
t.string "email", null: false
|
||||
t.string "name", null: false
|
||||
t.datetime "valid_to", null: false
|
||||
t.string "status", default: "new", null: false
|
||||
t.inet "ip_address"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["email"], name: "index_contact_requests_on_email"
|
||||
t.index ["ip_address"], name: "index_contact_requests_on_ip_address"
|
||||
t.index ["secret"], name: "index_contact_requests_on_secret", unique: true
|
||||
t.index ["whois_record_id"], name: "index_contact_requests_on_whois_record_id"
|
||||
end
|
||||
|
||||
create_table "contact_requests", id: :bigserial, force: :cascade do |t|
|
||||
t.integer "whois_record_id", null: false
|
||||
t.string "secret", null: false
|
||||
t.string "email", null: false
|
||||
t.string "name", null: false
|
||||
t.datetime "valid_to", null: false
|
||||
t.string "status", default: "new", null: false
|
||||
t.inet "ip_address"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "contact_requests", ["email"], name: "index_contact_requests_on_email", using: :btree
|
||||
add_index "contact_requests", ["ip_address"], name: "index_contact_requests_on_ip_address", using: :btree
|
||||
add_index "contact_requests", ["secret"], name: "index_contact_requests_on_secret", unique: true, using: :btree
|
||||
add_index "contact_requests", ["whois_record_id"], name: "index_contact_requests_on_whois_record_id", using: :btree
|
||||
|
||||
create_table "whois_records", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.json "json"
|
||||
t.string "name"
|
||||
t.json "json"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["name"], name: "index_domains_on_name"
|
||||
end
|
||||
|
||||
add_index "whois_records", ["name"], name: "index_domains_on_name", using: :btree
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue