brad
brad

Reputation: 501

uplaod local database data to heroku

I'm trying to upload my development data to my heroku site database -

I followed this guide:

How can I upload a DB to Heroku

I got the following error:

Please add the pgbackups addon first via:

heroku addons:add pgbackups

I ran the command above and got:

WARNING: heroku addons:add has been deprecated. Please use heroku addons:create instead. ! No such add-on plan.

I ran the command "heroku addons:create pgbackups" and got:

!    No such add-on plan.

I don't know what to do?

Upvotes: 2

Views: 2290

Answers (2)

Ekta
Ekta

Reputation: 21

For creating database type the following command inside your project :
heroku addons:create heroku-postgresql:hobby-dev

And after that type the following command to create a dump file of your local database:

pg_dump -h [host] -d [dbname] -p [port] -U [username] -F c -f [filename]
e.g. , pg_dump -h 127.0.0.1 -p 5432 -U postgres -F c -f dumpfile

where , filename = output file name , -F is for output file format (c=custom)

On typing this command you will be asked for a password . Type the password of your local database.

The file with name of [filename] will be created.

Now you need to upload this file on amazon s3.

Type the following command to import your local database dump file into your heroku database. Use the link of your uploaded file in the command.

heroku pg:backups:restore "https://s3.amazonaws.com/me/items/3H0q/mydb.dump" DATABASE_URL

reference : https://devcenter.heroku.com/articles/heroku-postgresql https://devcenter.heroku.com/articles/heroku-postgres-import-export#import

Upvotes: 2

Andrew Lavers
Andrew Lavers

Reputation: 8141

The guide you're following is outdated, the pgbackups addon has been deprecated.

Here's the guide you're looking for: https://devcenter.heroku.com/articles/heroku-postgres-backups

heroku pg:backups restore 'https://s3.amazonaws.com/me/items/mydb.dump' DATABASE -a sushi

Upvotes: 2

Related Questions