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