diff options
Diffstat (limited to 'db/migrate/20200907195410_add_index_to_users_username.rb')
-rw-r--r-- | db/migrate/20200907195410_add_index_to_users_username.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/db/migrate/20200907195410_add_index_to_users_username.rb b/db/migrate/20200907195410_add_index_to_users_username.rb new file mode 100644 index 000000000..06452e0dd --- /dev/null +++ b/db/migrate/20200907195410_add_index_to_users_username.rb @@ -0,0 +1,8 @@ +class AddIndexToUsersUsername < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + add_index :users, :username, unique: true, algorithm: :concurrently + add_index :users, 'lower(username)', unique: true, algorithm: :concurrently, name: 'index_on_users_username_lowercase' + end +end |