Projects / Bank ledger / Before you start
Before you start
You need PostgreSQL 14 or newer and the psql command-line client. The easiest way is Docker:
docker run --name ledger-pg -e POSTGRES_PASSWORD=ledger -p 5432:5432 -d postgres:16
Then point psql at it. Run these two lines in every terminal you open for this project:
export PGHOST=localhost PGUSER=postgres PGPASSWORD=ledger
psql postgres
If you already have PostgreSQL running on your machine, use that instead and skip Docker.
Every SQL statement and script in this project was run on PostgreSQL 16. Your ids, timestamps and timings will differ a little. The shape of the output is what matters.
Create the database and connect to it:
CREATE DATABASE ledger;
\c ledger
You should see You are now connected to database "ledger". Everything from here on happens inside ledger. The scripts in Phase 4 use your own terminal, so keep PGHOST, PGUSER and PGPASSWORD exported there.