Reputation: 2218
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)?
Upvotes: 0
Views: 33
Reputation: 8624
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.
Upvotes: 1