Reputation: 89
Is it possible to destroy a single record from my production PG database using an ActiveRecord command from my console? I know that I can do this locally by simply running the following command in my Rails console:
> User.find(1).destroy
However, I have tried running this for my production db:
> heroku run rake User.find(1).destroy
But it does not work. Any help would be greatly appreciated. Thanks!
Upvotes: 1
Views: 1385
Reputation: 608
its possible that you need to specify the app you are running. In that case it would be
heroku run console -a app_name
User.find(1).destroy
Upvotes: 1
Reputation: 13067
Run the console on heroku first with:
$ heroku run rails console
Then you can delete the record with the same query:
> User.find(1).destroy
If there are multiple apps configured from your folder, you will have to specify the app with --app=<app name>
in the heroku command line:
$ heroku run rails console --app=<app name>
Upvotes: 6