class InitUseIndex < ActiveRecord::Migration[5.2] def change remove_index :users, name: :index_users_on_login if index_exists?(:users, :login, name: :index_users_on_login) remove_index :users, name: :index_users_on_mail if index_exists?(:users, :mail, name: :index_users_on_mail) add_index :users, :login, unique: true add_index :users, :mail, unique: true add_index :users, :phone, unique: true end end