-
Notifications
You must be signed in to change notification settings - Fork 0
Database
Andrew Pope edited this page Nov 8, 2018
·
4 revisions
Build the docker image with postgres and the schema
docker build -t irs_db .
Run docker docker run --rm -p 5432:5432 irs_db
Instructions to manually create your local machine database development. The following assumes that you:
- Installed postgresql and during this process, the default postgres user has been created.
- The postgresql localhost server is running.
You can run
./database_setup.sh
to automatically create and load the schema or you can create the database your self and follow the steps below to load the schema.
After creating a new database called irs, run this command from terminal to generate schema:
sudo -u postgres psql irs < db/schema.sql
This structure will be loaded into the default public
schema.
Developers may also want to load some test records to their database.
They can do so with the example_restaurant.py
script:
python example_restaurant.py
To start from scratch, run:
echo "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" | sudo -u postgres psql irs