add uniqueness constraint on user names

This commit is contained in:
r888888888
2017-04-13 18:04:06 -07:00
parent 62fde705ce
commit 76b5031bbf
3 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
class AddUniqueNameConstraintToUsers < ActiveRecord::Migration
def up
remove_index :users, :name
execute "create unique index index_users_on_name on users(lower(name))"
end
end

View File

@@ -7579,3 +7579,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170330230231');
INSERT INTO schema_migrations (version) VALUES ('20170413000209');
INSERT INTO schema_migrations (version) VALUES ('20170414005856');