# Working on this app

A Protobase app: each resource's data config in `config/<name>/data.ts` and its screens in `config/<name>/ui.ts`, all
exported from `config/index.ts`, over a Postgres database. Reference: https://docs.protobase.net.

## Database changes

- Every schema change is a new migration file in `db/migrations/`, numbered after the last one (`009_returns.sql`).
  Never edit or remove a migration that exists: it has already run on the live database.
- Expand only, where possible: add tables, columns and indexes, and keep what the running app still reads. Rename or
  drop only when asked to, once nothing uses it.
- A new table gets `organization_id integer not null references core.organizations (id)` and `.tenant(...)`, like the
  others: people work in one organization at a time, and see only its rows (`auth/auth.ts`).

## Never touch

- `auth/` and the `auth` schema: sign-in and accounts.
- `.github/workflows/`.

## Scripts

The platform runs `db:migrate` (the auth schema's migrations included), `typecheck` and `test`, with their settings in
the environment: keep them working. Run `typecheck` and `test` before you finish. `db:seed:base` loads the reference data and organization 1 (in the auth schema too),
and `db:seed` the sample data, replacing everything in the app's tables.
