Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.4 KB

File metadata and controls

56 lines (39 loc) · 1.4 KB

MasteryPersistence

Ecto/PostgreSQL persistence layer for the Mastery poncho project (Designing Elixir Systems with OTP, ch. 9).

PostgreSQL (Docker)

A local Postgres instance runs via Docker Compose.

Start it:

docker compose up -d

Stop it (data persists in the mastery_persistence_pgdata volume):

docker compose down

Logs:

docker compose logs -f

Connection details (used both by config/*.exs and any external client):

Field Value
Host 127.0.0.1
Port 5432
User postgres
Password postgres

Connecting from VS Code

Install the PostgreSQL (Microsoft) extension, then in the PostgreSQL panel in the sidebar:

  1. Add Connection
  2. Server: 127.0.0.1 (not localhost — DNS resolution for localhost fails in this environment)
  3. Port: 5432
  4. Database: mastery_dev (add a second connection with mastery_test if you need to inspect test data mid-transaction)
  5. Authentication: Password — User postgres, Password postgres
  6. SSL: disabled (local dev container has no SSL configured)

Creating and migrating the databases (Ecto)

Requires Postgres running (see above).

mix ecto.create
mix ecto.migrate
MIX_ENV=test mix ecto.create
MIX_ENV=test mix ecto.migrate