Last Updated: February 25, 2016
·
925
· strotter

Update all PostgreSQL pkey sequences in Rails

# Updates all sequences in Rails to MAX(id)+1

ActiveRecord::Base.connection.tables.each do |table|
  ActiveRecord::Base.connection.reset_pk_sequence!(table)
end