Click on Remove button for the Heroku Postgres DB source that is already added. In your project's Hasura Console, head to Data tab. Remove the old Heroku Postgres DB connection. Apply migrations (skip execution) and apply metadata.Connect the new database as a data source in Hasura.Remove the old Heroku Postgres DB connection.This will involve the following steps to remove the old DB, connect the new DB and apply hasura metadata. #Heroku sql tabs superuser freeIn case you have more than one such free Heroku Postgres DB attached to your instance, repeat the above steps for the pg_dump and the Hasura CLI migrations on the same project with the db name being different. Hasura metadata export -endpoint -admin-secret Hasura migrate apply -endpoint -admin-secret -version 1627564572630 -skip-execution # copy the version number of the first migration directory/file # head to migrations directory to mark the generated one as applied Hasura migrate create init -sql-from-file # create an aggregate migration file from the SQL dump In case you don't, follow the below steps to create migration files and export metadata from your Heroku Postgres instance. If you already have a Hasura CLI project that contains migrations and metadata, you can skip this step. There are more of course and you can choose the vendor and import the SQL into their instance. Some of the popular vendors that give a free tier Postgres Database (with limits). You can now import this SQL into the database vendor of choice. This dump.sql will now have all the schemas along with the data in the database. But since we are using pg_dump to take a backup, we can simply pass the connection string directly. The connection string is of the format: the individual sections of the connection string if required. You will get an ENV value that looks something like the one below: Heroku Postgres Connection String Hasura Cloud ENV If you have multiple Heroku Postgres instances connected to your Hasura Cloud project, then the ENVs would follow the pattern of PG_DATABASE_URL* where * would represent the number of such connections. It should have the Postgres Connection String of the Heroku DB. Under Custom ENV vars, look out for PG_DATABASE_URL env. Head to Hasura Cloud Dashboard and navigate to the project details -> ENV vars section. If you are on Heroku free tier Postgres, you can make use of standard Postgres tools like pg_dump and psql to export/import the database.įind the Heroku Postgres connection string of the DB attached to your Hasura Cloud instance. #Heroku sql tabs superuser how toIn this post, we will look at how to take a backup of your Heroku Postgres DB and Hasura Metadata / Migrations so that you can migrate to a different DB vendor. #Heroku sql tabs superuser upgradeYou will need to either upgrade your Heroku account or migrate your Heroku Postgres database to a different database provider before November 28. What does this mean for you as a Hasura Cloud user? Heroku recently announced that they are deprecating free resource plans, starting November 28, for their Heroku Dynos, Heroku Postgres among others.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |