peppa/packages/cli/legacy-pg-migrations
Асель 3a282b8054 PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres
- packages/db: schema on sqlite-core (timestamps as epoch ms → Date, JSON as text,
  booleans 0/1), one baseline migration; node:sqlite client under drizzle's
  better-sqlite3 session (busy_timeout first, WAL, BEGIN IMMEDIATE, retries on
  SQLITE_BUSY, lazy open, async transaction callbacks refused); PEPPA_DB
  (default ~/.peppa/peppa.db)
- live updates: notify() pokes the bot over a unix socket; the bot also watches
  PRAGMA data_version every second (writes by other processes)
- Postgres specifics ported: createTask transaction is synchronous, no
  `for update skip locked`, `count(*)`, json_extract instead of ->>, json_each
  instead of @>
- `peppa db migrate` and `peppa db migrate-to-sqlite <file>` (read-only
  snapshot of Postgres, FK order from the schema, row count + foreign key
  checks, file appears only when they pass); old Postgres schema kept in
  packages/cli/legacy-pg-migrations for the migration and its test
- daily VACUUM INTO backup from the watchdog (7 copies, admin alert on failure)
- tests: a temp SQLite file per test file; storage.test.ts (20 processes,
  per-project numbering across processes, socket/data_version, migration from
  Postgres incl. a dangling foreign key, backups); two test races fixed
- CI: no per-run Postgres database; PEPPA_TEST_PG only for the migration test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 17:23:24 +05:00
..
0000_safe_shiver_man.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0001_chunky_dreadnoughts.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0002_happy_preak.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0003_material_wild_child.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0004_loving_wasp.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0005_sloppy_blue_marvel.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0006_crazy_stellaris.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0007_empty_crystal.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0008_wandering_jetstream.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0009_steady_preak.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0010_glamorous_ego.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0011_pep58_incidents.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0012_faithful_matthew_murdock.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00
0013_pep57_releases.sql PEP-36 stage 2: SQLite (node:sqlite, WAL) instead of Postgres 2026-11-13 17:23:24 +05:00