refactor: squash DB migrations 1-22 into a single baseline schema
base-schema.ts now holds the full schema at version 22, taken from the
production database (column order, indexes, provenance triggers), so a
fresh database is identical to the live one. Previously a fresh DB
differed: it had an extra idx_messages_chat_timestamp index and a
different column order in paired_tasks and paired_turn_outputs.
The migration runner keeps schema_migrations:
- empty DB: apply the baseline and record version 22 ('baseline')
- existing DB: must already be at version >= 22 (the live DB records
1-22), otherwise startup refuses it without touching it
- later migrations (23+) run once each inside a transaction
Removed the 22 historical migrations, the legacy schema bundle, the
paired-turn provenance rebuild/backfill helpers that migration 10 replayed
on every start (all no-ops on the live DB), legacy session migration
helpers, the unused service handoff metadata helpers, and the tests that
only exercised legacy-schema upgrades. New schema tests check a fresh DB
against a snapshot dumped from production and that reopening a DB at the
baseline changes neither schema nor data.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -99,6 +99,7 @@ Discord ──► SQLite (WAL) ──► GroupQueue ──┬──► Owner (ho
|
||||
- reviewer / arbiter가 직접 로컬 빌드를 못 돌려도, host verification 경로로 `typecheck`, `test`, `build`를 수행할 수 있음
|
||||
- startup precondition은 전용 오류로 올리고, setup이 생성하는 유닛은 `RestartPreventExitStatus=78`로 crash loop를 막음(현재 운영 호스트의 `ejclaw.service`는 수동 작성 유닛으로 `bun src/index.ts`를 실행하며 이 줄이 없고, 로그는 journald로 감)
|
||||
- deploy는 `migrate-room-registrations`를 선행한 뒤 service restart를 수행
|
||||
- DB 스키마: 과거 마이그레이션 1~22는 `src/db/base-schema.ts`(기준 버전 22) 하나로 합쳐짐. 새 DB는 이 스키마로 만들고, 기존 DB는 `schema_migrations` 최대 버전이 22 이상이어야 열림(그보다 오래된 DB는 시작 시 거부). 스키마 변경은 `src/db/migrations/index.ts`에 23번부터 마이그레이션을 추가하고 `src/db/schema.snapshot.sql`을 갱신
|
||||
|
||||
## 주요 파일
|
||||
|
||||
|
||||
Reference in New Issue
Block a user