mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Merge branch 'master' into registry-791
# Conflicts: # db/structure.sql
This commit is contained in:
commit
f299241b28
33 changed files with 343 additions and 344 deletions
5
db/migrate/20180612042234_enable_pgcrypto_ext.rb
Normal file
5
db/migrate/20180612042234_enable_pgcrypto_ext.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class EnablePgcryptoExt < ActiveRecord::Migration
|
||||
def change
|
||||
enable_extension 'pgcrypto'
|
||||
end
|
||||
end
|
5
db/migrate/20180612042625_add_uuid_to_contacts.rb
Normal file
5
db/migrate/20180612042625_add_uuid_to_contacts.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddUuidToContacts < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :contacts, :uuid, :uuid, default: 'gen_random_uuid()'
|
||||
end
|
||||
end
|
5
db/migrate/20180612042953_add_uuid_to_domains.rb
Normal file
5
db/migrate/20180612042953_add_uuid_to_domains.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddUuidToDomains < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :domains, :uuid, :uuid, default: 'gen_random_uuid()'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class ChangeContactsAndDomainsUuidToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :contacts, :uuid, false
|
||||
change_column_null :domains, :uuid, false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
# Unique constraint is needed to prevent accidental duplicate values in fixtures to appear in DB
|
||||
class AddContactsAndDomainsUuidUniqConstraint < ActiveRecord::Migration
|
||||
def up
|
||||
execute <<-SQL
|
||||
ALTER TABLE contacts ADD CONSTRAINT uniq_contact_uuid UNIQUE (uuid);
|
||||
ALTER TABLE domains ADD CONSTRAINT uniq_domain_uuid UNIQUE (uuid);
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<-SQL
|
||||
ALTER TABLE contacts DROP CONSTRAINT uniq_contact_uuid;
|
||||
ALTER TABLE domains DROP CONSTRAINT uniq_domain_uuid;
|
||||
SQL
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue