Add database constraints

This commit is contained in:
Artur Beljajev 2019-10-04 13:28:25 +03:00
parent 840f1db5c9
commit ba33f5740e
10 changed files with 345 additions and 225 deletions

View file

@ -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