Case database¶
The detailed view of a building block of 5.1; its summary is 5.2 — Case database.
| Aspect | Detail |
|---|---|
| Role | PostgreSQL with pgvector: the case and its business state, the case engine's tables, the outbox of the event backbone and each consumer's deduplication store; later the attribute values, findings, audit trail and embeddings — one database, so that a case's change and its event commit together (8.3) |
| Interfaces | Spring Data JDBC, which generates no schema (ADR-0019 (docs/adr/adr-0019-spring-data-jdbc-for-the-relational-store.md)); Flyway migrations, new files only (8.3); the persistence of the planned components of the backend |
| Replaces | the Firestore case store of ADR-0009 (docs/adr/adr-0009-async-intake-pubsub-bucket-firestore.md) §3 point 6, whose adapter and cloud database are removed |
| Per environment | a shared-core Cloud SQL instance for development and test on Google Cloud; a postgres container locally; H2 in memory in the offline build, loading the case store's and the outbox's migration files; PostgreSQL in a container in the integration tests |
| Decided by | ADR-0019 (docs/adr/adr-0019-spring-data-jdbc-for-the-relational-store.md): Spring Data JDBC; ADR-0018 (docs/adr/adr-0018-postgresql-authoritative-document-database-derived.md): authoritative for everything that belongs to a case |
| Status | built for the case, its pages and the outbox; the case engine's tables planned |
Tables¶
| Table | Holds | Created by |
|---|---|---|
cases |
one row per case: its state, the lease of the step running on it, an expiry no case reaches any more since a case is kept until it is deleted (8.3), the uploader, the gate's decision, its steps and the extraction's result as JSON text | the case store's migration |
case_pages |
one row per converted page of a case: the page's markdown, which is contract content; deleted with its case | the case store's migration |
event_publication |
Spring Modulith's event publication registry, the outbox: one row per event and listener, written in the transaction that publishes the event and completed when the listener has handled it | the outbox's migration |
flyway_schema_history |
Flyway's record of the migrations applied, with their checksums | Flyway |
The extension vector is created by the first migration. The engine's tables and the tables of the
planned components are not there yet.