-
Notifications
You must be signed in to change notification settings - Fork 13
Export Import DB for Testing
There is many ways to do this. For this document we will use a GUI.
Download Postgres.app
Startup Postgres.app and boom you now have a postgresQL server running with these values:
Host localhost
Port 5432
User your system user name
Database same as user
Password none
Connection URL postgresql://localhost
This guide looks decent, haven' tested.
Download heroku-cli here
Once installed login by running
heroku login
Grab the latest backup. (Note: this will create a latest.dump file in your current working directory):
heroku pg:backups:capture
heroku pg:backups:download --app grepthink
The following command assumes you're in the same working directory as latest.dump: (Note: replace 'myuser' with your local user, and 'mydb' with your postgres database name.
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump
If successful you should see messages regarding each table being restored.
Add the following to your .env file:
USE_POSTGRES_LOCAL=True
POSTGRES_DATABASE_URL=postgres://username:password@localhost/mydb
Thats it, you should be good to go. If you want to return to sqlite3 just toggle USE_LOCAL_POSTGRES to False.