|
1 | | -# SQLite match persistence |
| 1 | +# Match persistence |
2 | 2 |
|
3 | 3 | `SqliteMatchStore` implements the storage port in `gfa-service`. Inject an |
4 | 4 | `Arc<SqliteMatchStore>` into the lifecycle service when wiring a host. |
@@ -31,5 +31,26 @@ python3 .github/scripts/sqlite-query-check.py verify |
31 | 31 | ``` |
32 | 32 |
|
33 | 33 | When a query is removed, also remove its obsolete `.sqlx/query-*.json` file. |
34 | | -This adapter stores the initial match event model; searchable metadata, |
35 | | -retention policies, snapshots, and PostgreSQL support are separate increments. |
| 34 | +## PostgreSQL |
| 35 | + |
| 36 | +Enable the `postgres` feature and connect with |
| 37 | +`PostgresMatchStore::connect(url).await`. The pool applies the embedded |
| 38 | +`migrations/postgres` migrations at startup. Use a dedicated database and include |
| 39 | +`sslmode=verify-full` for a remote database. Call `close().await` on shutdown. |
| 40 | + |
| 41 | +PostgreSQL appends lock the match row before checking receipts and revisions. |
| 42 | +Snapshot reads use a repeatable-read transaction; assist counters use atomic |
| 43 | +upserts. Match IDs have C collation so cursor ordering agrees with the service. |
| 44 | +The SQLite and PostgreSQL adapters implement the same storage port. |
| 45 | + |
| 46 | +The PostgreSQL CI job compiles queries against a fresh migration-derived schema, |
| 47 | +checks the committed PostgreSQL metadata, and runs the ignored integration test |
| 48 | +against a separate empty database. To run it locally, set `DATABASE_URL` to a |
| 49 | +migrated query-checking database and `GFA_TEST_POSTGRES_URL` to an isolated empty |
| 50 | +test database, then run: |
| 51 | + |
| 52 | +```sh |
| 53 | +cargo test -p gfa-store --no-default-features --features postgres --locked -- --ignored |
| 54 | +``` |
| 55 | + |
| 56 | +Retention policies and materialized replay snapshots are separate increments. |
0 commit comments