AGENTS.md@packages/trueforge/src/db/postgres · git:20260917.1222563 · 2026-09-17 · sha256 f8c4d858e116deeb
AGENTS.md@packages/trueforge/src/db/postgres git:20260917.1222563A
Immutable. This exact content never changes and is served at /api/v1/blob/f8c4d858e116deeb.
- Temporal columns MUST use `timestamptz` (`timestamp with time zone`). Do not use `timestamp` without time zone. - Application timestamps MUST be treated as UTC instants. Serialize with `Date.prototype.toISOString()` (always `...Z` with milliseconds). - Do not run DB queries inside loops (N+1). Prefer a single batched query, a join, or an `IN`/`ANY` lookup over per-item round-trips. - Postgres migrations MUST start `up`/`down` with `SET LOCAL lock_timeout = '5s'` so waiting DDL fails fast instead of blocking later queries (including `SELECT`s) behind it in the lock queue. - All app tables and Kysely migration bookkeeping live in the configured Postgres schema (`POSTGRES_SCHEMA`, default `trueforge` — not `public`). The init migration owns `CREATE SCHEMA` (the Migrator also creates it for `migrationTableSchema`); `createDb` sets `search_path` to that schema.