0

I am using Heroku postgresql with my Rails 4 app.

My app has a Photo model which currently has 100 photos. I want to start over, deleting all of the existing photos so that the next uploaded photo will have photo_id: 1.

I found this answer but it appears that this would reset the entire database (meaning that all of my models would be reset instead of just the Photo model)?

Community
  • 1
  • 1
Timmy Von Heiss
  • 2,160
  • 17
  • 39

1 Answers1

1

You can access to heroku rails console and run:

Photo.destroy_all
ActiveRecord::Base.connection.execute("TRUNCATE table_name RESTART IDENTITY")

table_name is name of table which stores photos.

Thanh
  • 8,219
  • 5
  • 33
  • 56