T-57: M1.3b — trial_ledger + vault_evaluations append-only PostgreSQL migration (research track)
This commit is contained in:
parent
ed56ec1bbf
commit
bb6e91ef53
4 changed files with 155 additions and 22 deletions
|
|
@ -88,7 +88,7 @@ Computed on any synchronous screen/experiment return matrix $M \in \mathbb{R}^{T
|
|||
|
||||
### Vault Evaluations Schema (Append-Only)
|
||||
|
||||
Protected against `UPDATE`/`DELETE`/`TRUNCATE` by `reject_research_evidence_mutation()`. A `BEFORE INSERT` trigger forces `evaluated_at := now()` under a schema-scoped transaction advisory lock and rejects inserts once 10 evaluations exist in the rolling 1-year window (`evaluated_at > now() - interval '1 year'`), paired with a statement-level `AFTER INSERT` check so multi-row inserts cannot bypass the cap:
|
||||
Protected against `UPDATE`/`DELETE`/`TRUNCATE` by `reject_research_evidence_mutation()`. A `BEFORE INSERT` trigger requires `READ COMMITTED` transaction isolation (rejecting `REPEATABLE READ` and `SERIALIZABLE` so a waiting writer cannot evaluate the cap against a stale snapshot), forces `evaluated_at := now()` under a schema-scoped transaction advisory lock, and rejects inserts once 10 evaluations exist in the rolling 1-year window (`evaluated_at > now() - interval '1 year'`) on the target table (`TG_RELID`), paired with a statement-level `AFTER INSERT` check so multi-row inserts cannot bypass the cap:
|
||||
|
||||
```sql
|
||||
CREATE TABLE IF NOT EXISTS vault_evaluations (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue