mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 02:05:57 +02:00
Resolve merge errors
This commit is contained in:
commit
73e9dd6870
817 changed files with 16875 additions and 17443 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue