feat: add bounded postgres data migration stack

This commit is contained in:
ImBenji
2026-08-04 22:09:23 +01:00
parent 5877783862
commit ffc85719ff
3 changed files with 189 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
# PostgreSQL migration
The Compose stack includes PostgreSQL with a hard 512 MB container limit and
conservative in-server memory settings. Set `POSTGRES_PASSWORD` in the server
`.env`, then start it with `docker compose up -d postgres`.
Run the resumable logical copy with:
```sh
docker compose --profile migration run --rm postgres-migrate
```
It copies archive data to the `archive` schema and autonomy/intelligence data
to the `intelligence` schema. Each table is count-verified and progress is
persisted in each schema's `_migration_progress` table, so restarting resumes
at the last committed batch. SQLite vec0 internal tables are derived indexes;
their canonical embedding data is migrated from `article_embedding_store`.
The application is intentionally not switched by this migration alone: it has
SQLite-specific synchronous query and transaction code in the autonomy workers
and admin routes. Pointing those processes at PostgreSQL before that code is
ported would make the live system unreliable. Keep SQLite mounted until a
separate verified runtime cutover is complete.