ActiveRecord::Base.connection.add_index:users,['reset_password_token'],name:'index_users_on_reset_password_token',unique:true,where:'reset_password_token IS NOT NULL',opclass::text_pattern_ops
end
end
defdeduplicate_users_process_confirmation_token
ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE confirmation_token IS NOT NULL GROUP BY confirmation_token HAVING count(*) > 1").eachdo|row|
ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE remember_token IS NOT NULL GROUP BY remember_token HAVING count(*) > 1").eachdo|row|
ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE reset_password_token IS NOT NULL GROUP BY reset_password_token HAVING count(*) > 1").eachdo|row|
ActiveRecord::Base.connection.add_index:users,['reset_password_token'],name:'index_users_on_reset_password_token',unique:true,where:'reset_password_token IS NOT NULL',opclass::text_pattern_ops