1

I have a Heroku app that I imported existing data into. Apparently it has screwed up my pk sequences in all my tables. How can I reset all the sequences of my tables?

I found this Rails auto-assigning id that already exists

And it says to use this:

ActiveRecord::Base.connection.tables.each do |t|
  ActiveRecord::Base.connection.reset_pk_sequence!(t)
end;nil

My problem is I have no idea how to run this on my Heroku app.

Any help is appreciated!!!

Community
  • 1
  • 1
Darkmatter5
  • 1,189
  • 3
  • 12
  • 19

1 Answers1

0

You run whatever you need from Rails console on Heroku by doing this:

heroku run bundle exec rails console

In fact, you can run a number of commands, but starting them with heroku run.

jordelver
  • 8,292
  • 2
  • 32
  • 40