-
Notifications
You must be signed in to change notification settings - Fork 54
debugging importing a database dump locally
Sometimes it is necessary to import a database dump on a local machine, e.g. to debug problems which only happen in production. Here is one way to do that.
/usr/bin/pg_dump --inserts --file=/path/to/save/dump.sql --dbname=<insert-db-name-here> --username=<insert-db-user-here> --host=<insert-db-host-here> --port=<insert-db-port-here>
Start your local ecamp3 normally.
To import the dumped data, we need to temporarily disable all foreign key checks. This can be done by inserting the following lines into the dump.sql:
# Insert this line at the very top:
SET session_replication_role = 'replica';
# and this line at the very bottom:
SET session_replication_role = 'origin';
Then, import the modified dump using psql
:
psql -U ecamp3 --host localhost --port 5432 ecamp3dev < ./prod-dump.sql
As password, enter ecamp3
There might be some errors due to indexes and foreign keys which are already present in your database. You can safely ignore these.
Your login from production will not work (I think it is because some application secrets are not the same on prod and on your local machine, haven't investigated though). As an easy workaround, you can reset your password and receive the reset email at http://localhost:3000/mail.
Make sure to delete any production data dumps when you are finished!
- Home
- Installation
- Domain Object Model
- API
- Design
- Localization and translations
- Architecture
-
Testing guide
- API testing (TBD)
- Frontend testing
- E2E testing (TBD)
- Deployment
- Debugging