Merge branch 'registry-765' into registry-623

# Conflicts:
#	app/models/registrar.rb
#	config/locales/en.yml
#	spec/models/registrar_spec.rb
#	test/models/registrar_test.rb
This commit is contained in:
Artur Beljajev 2018-03-09 09:30:05 +02:00
commit 4f51f6c736
35 changed files with 464 additions and 482 deletions

View file

@ -0,0 +1,19 @@
class AddRegistrarsUniqueConstraints < ActiveRecord::Migration
def up
execute <<-SQL
ALTER TABLE registrars ADD CONSTRAINT unique_name UNIQUE (name);
ALTER TABLE registrars ADD CONSTRAINT unique_reg_no UNIQUE (reg_no);
ALTER TABLE registrars ADD CONSTRAINT unique_reference_no UNIQUE (reference_no);
ALTER TABLE registrars ADD CONSTRAINT unique_code UNIQUE (code);
SQL
end
def down
execute <<-SQL
ALTER TABLE registrars DROP CONSTRAINT unique_name;
ALTER TABLE registrars DROP CONSTRAINT unique_reg_no;
ALTER TABLE registrars DROP CONSTRAINT unique_reference_no;
ALTER TABLE registrars DROP CONSTRAINT unique_code;
SQL
end
end

View file

@ -0,0 +1,6 @@
class RemoveRegistrarsIndexes < ActiveRecord::Migration
def change
remove_index :registrars, name: :index_registrars_on_code
remove_index :registrars, name: :index_registrars_on_legacy_id
end
end

View file

@ -0,0 +1,9 @@
class AddRegistrarsNotNullConstraints < ActiveRecord::Migration
def change
change_column_null :registrars, :name, false
change_column_null :registrars, :reg_no, false
change_column_null :registrars, :country_code, false
change_column_null :registrars, :email, false
change_column_null :registrars, :code, false
end
end