Heroku Postgress Database automatically changed after the upgrade - heroku

We recently upgraded the plan on Heroku from free. Post this upgrade, our existing database got deleted and Heroku added a new database for the app.
Now we have lost the existing tables and we haven't took a backup for the same. Due to this our app is not connecting.
Is there a way to restore the previous database(PostgreSQL)so that our data will be back and the app will also connect back.

Related

Heroku reattach a deprovisioned portgres database ( Hobby-Basic )

I have unintentionally detached a Hobby-Basic postgres database from my application. Is there any way I can recover the database or the database backup?
I was able to get the database url by using heroku release:info command.
We reached out to heroku support team and they reattached the detached db from their end.

Laravel sqlite database locked

I am using the Azure web app with PHP 7.3 stack. In my project, we have the feature to sync from mobile to web and for that, we are using the SQLite file. And for other modules, we have a MySQL database.
The mobile app sends the SQLite file and we stored it in the directory. But we try to make a query to the SQLite with PDO then it throws the error that the database is locked.
I tried many solutions from the other's answer but not get success.
This has to do with permissions of the underlying storage mount.
One option you could try is mounting an Azure File share and persisting the database there, see https://learn.microsoft.com/answers/answers/320889/view.html. The best option however is to utilize a cloud database such as Postgres or MySQL for Azure.

Can a Postgres DB on heroku be restored after delete

I have unintentionally deleted my Postgres DB on my heroku "Hobby Dev" instance. Does heroku keep a backup that could be used to restore it?
Hobby databases do not have access to the point-in-time recovery feature that is available on the production tier of databases. If you haven't captured any logical backups with heroku pg:backups then there's no way to recover what you've deleted.

Heroku: How Can I Stop My Postgres Databases from Disappearing after a few minutes?

Yesterday I uploaded a Rails 5 application with multiple databases to Heroku. I have a hobby-dev postgres add-on. This morning I successfully imported my 7 Postgres databases using pg_dump backups created according to the Heroku documentation.
PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump
heroku pg:backups:restore 'https://s3.amazonaws.com/me/items/3H0q/mydb.dump' HEROKU_POSTGRESQL_COLOR_URL
Several times I have imported these databases because after a few minutes they disappear. I ran my Heroku app and the first database was successfully accessed but by the time I tried to access the second one I received a 'relation "xxxx" does not exist'. When I went back to my datastore the databases were gone. When I tried to run my app a second time I got a 'relation "xxxx" does not exist' on the first table that I successfully accessed the previous time I ran my app.
I'm not seeing any errors when I look at the data-store for the database. They just disappear. I checked to see if there was a limit to the number of databases I could have with the hobby-dev but did not see any. The row count is under 10,000. Each time I have imported my pg_dump files I get a warning email about the number of rows.
UPDATE 2/17/2017 10:42 AM central: The only thing I have found so far are some posts stating that the Heroku filesystem is ephemeral, and does not persist between dyno restarts. If this is my problem:
How do I know when dynos restart if I don't restart it? I had not restarted my app when my databases disappeared.
How can I permanently store my databases using the Postgres add-on or do I have to store my databases elsewhere? Surely the add-on has a way to permanently store databases.
I assume you use Heroku PostgreSQL offering (instead of trying to set it up on your own). If that's the case the ephemeral nature of dyno file systems shouldn't be your concern.
I recommend that you first create the seven (empty) databases and see if they disappear or not. You can create a single database with
heroku addons:create heroku-postgresql:hobby-dev
After each call run heroku pg:wait to wait until the database has been provisioned. If the databases don't disappear try restoring your backups then.

Can't use PSQL with a Heroku shared database

I'm developing an application and hosting it on Heroku. For now, I want to use the free shared database solution.
My problem is that I can't access the database.
$ heroku pg:psql
! Cannot ingress to a shared database
I've read elsewhere that I can't connect to shared databases via psql.
I can't seem to find any information on that on Heroku's Dev Center, so this leaves me with the question - how can I edit or change or do anything with my database?
If you're happy to use a beta addon then there is the Heroku Shared PostgreSQL 9.1 addon (https://addons.heroku.com/heroku-shared-postgresql) which will permit you to ingress to your database.
However, any changes to your database are usually best done with scripted migrations (in the Ruby on Rails world) rather than connecting to your database to make changes.
If you're more familiar with mySQL then there are a number of mySQL addons which permit direct access also with normal mySQL tools.

Resources