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
|
|
@ -175,9 +175,15 @@ describe('36-trial-ledger.sql static contract', () => {
|
|||
|
||||
// Rolling-year cap functions & triggers
|
||||
expect(sql).toContain('CREATE OR REPLACE FUNCTION enforce_vault_evaluation_cap()');
|
||||
expect(sql).toContain(
|
||||
"current_setting('transaction_isolation') NOT IN ('read committed', 'read uncommitted')"
|
||||
);
|
||||
expect(sql).toContain("USING ERRCODE = '25000'");
|
||||
expect(sql).toContain('pg_advisory_xact_lock');
|
||||
expect(sql).toContain('NEW.evaluated_at := now();');
|
||||
expect(sql).toContain("evaluated_at > now() - interval '1 year'");
|
||||
expect(sql).toContain("evaluated_at > now() - interval ''1 year''");
|
||||
expect(sql).toContain('TG_RELID::regclass');
|
||||
expect(sql).not.toContain('FROM vault_evaluations');
|
||||
expect(sql).toContain('IF recent_count >= 10 THEN');
|
||||
expect(sql).toContain('DROP TRIGGER IF EXISTS vault_evaluations_cap ON vault_evaluations;');
|
||||
expect(sql).toContain(
|
||||
|
|
@ -186,6 +192,7 @@ describe('36-trial-ledger.sql static contract', () => {
|
|||
|
||||
expect(sql).toContain('CREATE OR REPLACE FUNCTION verify_vault_evaluation_cap_after()');
|
||||
expect(sql).toContain('IF recent_count > 10 THEN');
|
||||
expect(sql.match(/TG_RELID::regclass/g)?.length).toBe(2);
|
||||
expect(sql).toContain(
|
||||
'DROP TRIGGER IF EXISTS vault_evaluations_cap_after ON vault_evaluations;'
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue