mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
Add database constraints
This commit is contained in:
parent
840f1db5c9
commit
ba33f5740e
10 changed files with 345 additions and 225 deletions
|
@ -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
|
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
|
491
db/structure.sql
491
db/structure.sql
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue