Foundation / checks (ecs) (push) Successful in 2m24s
Foundation / checks (deploy) (push) Successful in 4m51s
Foundation / checks (network) (push) Successful in 20m42s
Foundation / checks (client) (push) Successful in 21m53s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 40m19s
Foundation / checks (postgres) (push) Canceled after 40m9s
Foundation / checks (tsan) (push) Canceled after 37m53s
ADR-0174 and schema 56 add checkpoint profile 6, which stores the joint cell/environment envelope nesting population envelope 2 (bundles 10 and 11). Entry from a committed population head is explicit, one-way and no-tick, with the source commit, manifest and payload digests bound in immutable evidence. Joint intervals use schema 45's owned admission and settlement; conversions cannot overtake a pending interval. The fenced publisher validates the joint trace structurally, including the complete nested population batch, and records per-commit imported and radiated totals. Recovery replays the head's link and requires the payload exactly, refusing a forged but structurally valid trace. A trigger refuses profile-6 commits from every other publisher; profile 4/5 bytes, parsers and rules are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
985 lines
50 KiB
PL/PgSQL
985 lines
50 KiB
PL/PgSQL
\set ON_ERROR_STOP on
|
|
BEGIN;
|
|
SET LOCAL search_path = pg_catalog;
|
|
SET LOCAL statement_timeout = '10s';
|
|
SET LOCAL lock_timeout = '5s';
|
|
SELECT pg_catalog.pg_advisory_xact_lock(71420001);
|
|
SELECT current_setting('server_version_num')::int = 180006 AS supported \gset
|
|
\if :supported
|
|
\else
|
|
\echo 'Unsupported PostgreSQL version; expected 18.6'
|
|
DO $$ BEGIN RAISE EXCEPTION 'unsupported PostgreSQL version'; END $$;
|
|
\endif
|
|
SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution') AS exists \gset
|
|
\if :exists
|
|
-- Only an exact prefix of the checked-in history is admitted. Unknown or
|
|
-- partial/foreign schemas fail closed; no IF NOT EXISTS repair of foreign data.
|
|
SELECT coalesce(string_agg(version || ':' || sha256, ',' ORDER BY version), '')
|
|
AS history FROM evolution.schema_migrations \gset
|
|
SELECT :'history' = '1:' || :'migration_sha' AS at_v1,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' AS at_v2,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' AS at_v3,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' AS at_v4,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' AS at_v5,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' AS at_v6,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' AS at_v7,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' AS at_v8,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
|
|| ',9:' || :'migration_sha_9' AS at_v9,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
|
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' AS at_v10,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
|
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10'
|
|
|| ',11:' || :'migration_sha_11' AS at_v11,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
|
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10'
|
|
|| ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12'
|
|
AS at_v12,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
|
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10'
|
|
|| ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12'
|
|
|| ',13:' || :'migration_sha_13' AS at_v13,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
|
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10'
|
|
|| ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12'
|
|
|| ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14'
|
|
AS at_v14,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
|
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10'
|
|
|| ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12'
|
|
|| ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14'
|
|
|| ',15:' || :'migration_sha_15' AS at_v15,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2'
|
|
|| ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4'
|
|
|| ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6'
|
|
|| ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8'
|
|
|| ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10'
|
|
|| ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12'
|
|
|| ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14'
|
|
|| ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' AS at_v16,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' AS at_v17,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' || ',18:' || :'migration_sha_18' AS at_v18,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' || ',18:' || :'migration_sha_18' || ',19:' || :'migration_sha_19' AS at_v19,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' || ',18:' || :'migration_sha_18' || ',19:' || :'migration_sha_19' || ',20:' || :'migration_sha_20' AS at_v20,
|
|
:'history' = '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' || ',18:' || :'migration_sha_18' || ',19:' || :'migration_sha_19' || ',20:' || :'migration_sha_20' || ',21:' || :'migration_sha_21' AS at_v21 \gset
|
|
-- v22+ also admit only the exact full history, not just a matching tail.
|
|
SELECT '1:' || :'migration_sha' || ',2:' || :'migration_sha_2' || ',3:' || :'migration_sha_3' || ',4:' || :'migration_sha_4' || ',5:' || :'migration_sha_5' || ',6:' || :'migration_sha_6' || ',7:' || :'migration_sha_7' || ',8:' || :'migration_sha_8' || ',9:' || :'migration_sha_9' || ',10:' || :'migration_sha_10' || ',11:' || :'migration_sha_11' || ',12:' || :'migration_sha_12' || ',13:' || :'migration_sha_13' || ',14:' || :'migration_sha_14' || ',15:' || :'migration_sha_15' || ',16:' || :'migration_sha_16' || ',17:' || :'migration_sha_17' || ',18:' || :'migration_sha_18' || ',19:' || :'migration_sha_19' || ',20:' || :'migration_sha_20' || ',21:' || :'migration_sha_21' AS history_v21 \gset
|
|
SELECT :'history_v21' || ',22:' || :'migration_sha_22' AS history_v22 \gset
|
|
SELECT :'history_v22' || ',23:' || :'migration_sha_23' AS history_v23 \gset
|
|
SELECT :'history_v23' || ',24:' || :'migration_sha_24' AS history_v24 \gset
|
|
SELECT :'history_v24' || ',25:' || :'migration_sha_25' AS history_v25 \gset
|
|
SELECT :'history_v25' || ',26:' || :'migration_sha_26' AS history_v26 \gset
|
|
SELECT :'history_v26' || ',27:' || :'migration_sha_27' AS history_v27 \gset
|
|
SELECT :'history_v27' || ',28:' || :'migration_sha_28' AS history_v28 \gset
|
|
SELECT :'history_v28' || ',29:' || :'migration_sha_29' AS history_v29 \gset
|
|
SELECT :'history_v29' || ',30:' || :'migration_sha_30' AS history_v30 \gset
|
|
SELECT :'history_v30' || ',31:' || :'migration_sha_31' AS history_v31 \gset
|
|
SELECT :'history_v31' || ',32:' || :'migration_sha_32' AS history_v32 \gset
|
|
SELECT :'history_v32' || ',33:' || :'migration_sha_33' AS history_v33 \gset
|
|
SELECT :'history_v33' || ',34:' || :'migration_sha_34' AS history_v34 \gset
|
|
SELECT :'history_v34' || ',35:' || :'migration_sha_35' AS history_v35 \gset
|
|
SELECT :'history_v35' || ',36:' || :'migration_sha_36' AS history_v36 \gset
|
|
SELECT :'history_v36' || ',37:' || :'migration_sha_37' AS history_v37 \gset
|
|
SELECT :'history_v37' || ',38:' || :'migration_sha_38' AS history_v38 \gset
|
|
SELECT :'history_v38' || ',39:' || :'migration_sha_39' AS history_v39 \gset
|
|
SELECT :'history_v39' || ',40:' || :'migration_sha_40' AS history_v40 \gset
|
|
SELECT :'history_v40' || ',41:' || :'migration_sha_41' AS history_v41 \gset
|
|
SELECT :'history_v41' || ',42:' || :'migration_sha_42' AS history_v42 \gset
|
|
SELECT :'history_v42' || ',43:' || :'migration_sha_43' AS history_v43 \gset
|
|
SELECT :'history_v43' || ',44:' || :'migration_sha_44' AS history_v44 \gset
|
|
SELECT :'history_v44' || ',45:' || :'migration_sha_45' AS history_v45 \gset
|
|
SELECT :'history_v45' || ',46:' || :'migration_sha_46' AS history_v46 \gset
|
|
SELECT :'history_v46' || ',47:' || :'migration_sha_47' AS history_v47 \gset
|
|
SELECT :'history_v47' || ',48:' || :'migration_sha_48' AS history_v48 \gset
|
|
SELECT :'history_v48' || ',49:' || :'migration_sha_49' AS history_v49 \gset
|
|
SELECT :'history_v49' || ',50:' || :'migration_sha_50' AS history_v50 \gset
|
|
SELECT :'history_v50' || ',51:' || :'migration_sha_51' AS history_v51 \gset
|
|
SELECT :'history_v51' || ',52:' || :'migration_sha_52' AS history_v52 \gset
|
|
SELECT :'history_v52' || ',53:' || :'migration_sha_53' AS history_v53 \gset
|
|
SELECT :'history_v53' || ',54:' || :'migration_sha_54' AS history_v54 \gset
|
|
SELECT :'history_v54' || ',55:' || :'migration_sha_55' AS history_v55 \gset
|
|
SELECT :'history_v55' || ',56:' || :'migration_sha_56' AS history_v56 \gset
|
|
SELECT :'history' = :'history_v22' AS at_v22,
|
|
:'history' = :'history_v23' AS at_v23,
|
|
:'history' = :'history_v24' AS at_v24,
|
|
:'history' = :'history_v25' AS at_v25,
|
|
:'history' = :'history_v26' AS at_v26,
|
|
:'history' = :'history_v27' AS at_v27,
|
|
:'history' = :'history_v28' AS at_v28,
|
|
:'history' = :'history_v29' AS at_v29,
|
|
:'history' = :'history_v30' AS at_v30,
|
|
:'history' = :'history_v31' AS at_v31,
|
|
:'history' = :'history_v32' AS at_v32,
|
|
:'history' = :'history_v33' AS at_v33,
|
|
:'history' = :'history_v34' AS at_v34,
|
|
:'history' = :'history_v35' AS at_v35,
|
|
:'history' = :'history_v36' AS at_v36,
|
|
:'history' = :'history_v37' AS at_v37,
|
|
:'history' = :'history_v38' AS at_v38,
|
|
:'history' = :'history_v39' AS at_v39,
|
|
:'history' = :'history_v40' AS at_v40,
|
|
:'history' = :'history_v41' AS at_v41,
|
|
:'history' = :'history_v42' AS at_v42,
|
|
:'history' = :'history_v43' AS at_v43,
|
|
:'history' = :'history_v44' AS at_v44,
|
|
:'history' = :'history_v45' AS at_v45,
|
|
:'history' = :'history_v46' AS at_v46,
|
|
:'history' = :'history_v47' AS at_v47,
|
|
:'history' = :'history_v48' AS at_v48,
|
|
:'history' = :'history_v49' AS at_v49,
|
|
:'history' = :'history_v50' AS at_v50,
|
|
:'history' = :'history_v51' AS at_v51,
|
|
:'history' = :'history_v52' AS at_v52,
|
|
:'history' = :'history_v53' AS at_v53,
|
|
:'history' = :'history_v54' AS at_v54,
|
|
:'history' = :'history_v55' AS at_v55,
|
|
:'history' = :'history_v56' AS at_v56 \gset
|
|
\if :at_v56
|
|
\elif :at_v55
|
|
\elif :at_v54
|
|
\elif :at_v53
|
|
\elif :at_v52
|
|
\elif :at_v51
|
|
\elif :at_v50
|
|
\elif :at_v49
|
|
\elif :at_v48
|
|
\elif :at_v47
|
|
\elif :at_v46
|
|
\elif :at_v45
|
|
\elif :at_v44
|
|
\elif :at_v43
|
|
\elif :at_v42
|
|
\elif :at_v41
|
|
\elif :at_v40
|
|
\elif :at_v39
|
|
\elif :at_v38
|
|
\elif :at_v37
|
|
\elif :at_v36
|
|
\elif :at_v35
|
|
\elif :at_v34
|
|
\elif :at_v33
|
|
\elif :at_v32
|
|
\elif :at_v31
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\elif :at_v30
|
|
\ir 0031_fix_cellular_birth_publication_record.sql
|
|
\elif :at_v29
|
|
\elif :at_v28
|
|
\ir 0029_cellular_mutation_reservations.sql
|
|
\elif :at_v27
|
|
\ir 0028_cellular_v3_trace_bounds.sql
|
|
\elif :at_v26
|
|
\ir 0027_cellular_v3_migration.sql
|
|
\elif :at_v25
|
|
\elif :at_v24
|
|
\elif :at_v23
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v22
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v21
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v20
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v19
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v18
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v17
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v16
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v15
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v14
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v13
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v12
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v11
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v10
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v9
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v8
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v7
|
|
\ir 0008_upgrade_barrier.sql
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v6
|
|
\ir 0007_region_clones.sql
|
|
\ir 0008_upgrade_barrier.sql
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v5
|
|
\ir 0006_commit_lookup.sql
|
|
\ir 0007_region_clones.sql
|
|
\ir 0008_upgrade_barrier.sql
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v4
|
|
\ir pre_v5_guard.sql
|
|
\ir 0005_batch_decisions.sql
|
|
\ir 0006_commit_lookup.sql
|
|
\ir 0007_region_clones.sql
|
|
\ir 0008_upgrade_barrier.sql
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v3
|
|
\ir 0004_lineage_profile.sql
|
|
\ir pre_v5_guard.sql
|
|
\ir 0005_batch_decisions.sql
|
|
\ir 0006_commit_lookup.sql
|
|
\ir 0007_region_clones.sql
|
|
\ir 0008_upgrade_barrier.sql
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v2
|
|
\ir 0003_region_checkpoints.sql
|
|
\ir 0004_lineage_profile.sql
|
|
\ir pre_v5_guard.sql
|
|
\ir 0005_batch_decisions.sql
|
|
\ir 0006_commit_lookup.sql
|
|
\ir 0007_region_clones.sql
|
|
\ir 0008_upgrade_barrier.sql
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\elif :at_v1
|
|
\ir 0002_region_fencing.sql
|
|
\ir 0003_region_checkpoints.sql
|
|
\ir 0004_lineage_profile.sql
|
|
\ir pre_v5_guard.sql
|
|
\ir 0005_batch_decisions.sql
|
|
\ir 0006_commit_lookup.sql
|
|
\ir 0007_region_clones.sql
|
|
\ir 0008_upgrade_barrier.sql
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\else
|
|
\echo 'Unknown or changed migration history'
|
|
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
|
|
\endif
|
|
\else
|
|
\ir 0001_region_bootstrap.sql
|
|
\ir 0002_region_fencing.sql
|
|
\ir 0003_region_checkpoints.sql
|
|
\ir 0004_lineage_profile.sql
|
|
\ir pre_v5_guard.sql
|
|
\ir 0005_batch_decisions.sql
|
|
\ir 0006_commit_lookup.sql
|
|
\ir 0007_region_clones.sql
|
|
\ir 0008_upgrade_barrier.sql
|
|
\ir 0009_serialized_authority.sql
|
|
\ir 0010_account_control.sql
|
|
\ir 0011_region_actions.sql
|
|
\ir 0012_probe_handoff.sql
|
|
\ir 0013_probe_incoming.sql
|
|
\ir 0014_probe_overdue.sql
|
|
\ir 0015_life_reservations.sql
|
|
\ir 0016_primitive_publication.sql
|
|
\ir 0017_life_request_outcomes.sql
|
|
\ir 0018_cellular_profile_admission.sql
|
|
\ir 0019_cellular_action_records.sql
|
|
\ir 0020_cellular_publication.sql
|
|
\ir 0021_cellular_trace_and_recovery.sql
|
|
\ir 0022_cellular_birth_trace_bound.sql
|
|
\ir 0023_cellular_birth_publication.sql
|
|
\ir 0024_primitive_life_owner_lookup.sql
|
|
\endif
|
|
-- The versioned branch above leaves an admitted schema at v24 or newer. Apply
|
|
-- additive follow-ups from that exact prefix, including on a fresh bootstrap.
|
|
SELECT coalesce(max(version), 0) = 24 AS at_v24,
|
|
coalesce(max(version), 0) = 25 AS at_v25,
|
|
coalesce(max(version), 0) = 26 AS at_v26,
|
|
coalesce(max(version), 0) = 27 AS at_v27,
|
|
coalesce(max(version), 0) = 28 AS at_v28,
|
|
coalesce(max(version), 0) = 29 AS at_v29,
|
|
coalesce(max(version), 0) = 30 AS at_v30,
|
|
coalesce(max(version), 0) = 31 AS at_v31,
|
|
coalesce(max(version), 0) = 32 AS at_v32,
|
|
coalesce(max(version), 0) = 33 AS at_v33,
|
|
coalesce(max(version), 0) = 34 AS at_v34,
|
|
coalesce(max(version), 0) = 35 AS at_v35,
|
|
coalesce(max(version), 0) = 36 AS at_v36,
|
|
coalesce(max(version), 0) = 37 AS at_v37,
|
|
coalesce(max(version), 0) = 38 AS at_v38,
|
|
coalesce(max(version), 0) = 39 AS at_v39,
|
|
coalesce(max(version), 0) = 40 AS at_v40,
|
|
coalesce(max(version), 0) = 41 AS at_v41,
|
|
coalesce(max(version), 0) = 42 AS at_v42,
|
|
coalesce(max(version), 0) = 43 AS at_v43,
|
|
coalesce(max(version), 0) = 44 AS at_v44,
|
|
coalesce(max(version), 0) = 45 AS at_v45,
|
|
coalesce(max(version), 0) = 46 AS at_v46,
|
|
coalesce(max(version), 0) = 47 AS at_v47,
|
|
coalesce(max(version), 0) = 48 AS at_v48,
|
|
coalesce(max(version), 0) = 49 AS at_v49,
|
|
coalesce(max(version), 0) = 50 AS at_v50,
|
|
coalesce(max(version), 0) = 51 AS at_v51,
|
|
coalesce(max(version), 0) = 52 AS at_v52,
|
|
coalesce(max(version), 0) = 53 AS at_v53,
|
|
coalesce(max(version), 0) = 54 AS at_v54,
|
|
coalesce(max(version), 0) = 55 AS at_v55,
|
|
coalesce(max(version), 0) = 56 AS at_v56
|
|
FROM evolution.schema_migrations \gset
|
|
\if :at_v24
|
|
\ir 0025_cellular_v2_bundle.sql
|
|
\ir 0026_cellular_profile_migration.sql
|
|
\ir 0027_cellular_v3_migration.sql
|
|
\ir 0028_cellular_v3_trace_bounds.sql
|
|
\ir 0029_cellular_mutation_reservations.sql
|
|
\ir 0030_cellular_birth_publication_binding.sql
|
|
\ir 0031_fix_cellular_birth_publication_record.sql
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v25
|
|
\ir 0026_cellular_profile_migration.sql
|
|
\ir 0027_cellular_v3_migration.sql
|
|
\ir 0028_cellular_v3_trace_bounds.sql
|
|
\ir 0029_cellular_mutation_reservations.sql
|
|
\ir 0030_cellular_birth_publication_binding.sql
|
|
\ir 0031_fix_cellular_birth_publication_record.sql
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v26
|
|
\ir 0027_cellular_v3_migration.sql
|
|
\ir 0028_cellular_v3_trace_bounds.sql
|
|
\ir 0029_cellular_mutation_reservations.sql
|
|
\ir 0030_cellular_birth_publication_binding.sql
|
|
\ir 0031_fix_cellular_birth_publication_record.sql
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v27
|
|
\ir 0028_cellular_v3_trace_bounds.sql
|
|
\ir 0029_cellular_mutation_reservations.sql
|
|
\ir 0030_cellular_birth_publication_binding.sql
|
|
\ir 0031_fix_cellular_birth_publication_record.sql
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v28
|
|
\ir 0029_cellular_mutation_reservations.sql
|
|
\ir 0030_cellular_birth_publication_binding.sql
|
|
\ir 0031_fix_cellular_birth_publication_record.sql
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v29
|
|
\ir 0030_cellular_birth_publication_binding.sql
|
|
\ir 0031_fix_cellular_birth_publication_record.sql
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v30
|
|
\ir 0031_fix_cellular_birth_publication_record.sql
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v31
|
|
\ir 0032_fix_cellular_v3_manifest_normalization.sql
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v32
|
|
\ir 0033_fix_cellular_action_tick_offset.sql
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v33
|
|
\ir 0034_cellular_v4_engulf_bundle.sql
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v34
|
|
\ir 0035_cellular_mutation_publication.sql
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v35
|
|
\ir 0036_cellular_v5_budding_bundle.sql
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v36
|
|
\ir 0037_cellular_life_endings.sql
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v37
|
|
\ir 0038_cellular_v6_presence_bundle.sql
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v38
|
|
\ir 0039_account_identities.sql
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v39
|
|
\ir 0040_cellular_mutation_decline.sql
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v40
|
|
\ir 0041_cellular_v7_balance_bundle.sql
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v41
|
|
\ir 0042_cellular_v8_reproduction_bundle.sql
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v42
|
|
\ir 0043_cellular_v9_foraging_bundle.sql
|
|
\elif :at_v43
|
|
\elif :at_v44
|
|
\elif :at_v45
|
|
\elif :at_v46
|
|
\elif :at_v47
|
|
\elif :at_v48
|
|
\elif :at_v49
|
|
\elif :at_v50
|
|
\elif :at_v51
|
|
\elif :at_v52
|
|
\elif :at_v53
|
|
\elif :at_v54
|
|
\elif :at_v55
|
|
\elif :at_v56
|
|
\else
|
|
\echo 'Unknown or changed migration history after v43'
|
|
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 43 AS needs_v44 FROM evolution.schema_migrations \gset
|
|
\if :needs_v44
|
|
\ir 0044_exact_population_publication.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 44 AS needs_v45 FROM evolution.schema_migrations \gset
|
|
\if :needs_v45
|
|
\ir 0045_owned_population_intervals.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 45 AS needs_v46 FROM evolution.schema_migrations \gset
|
|
\if :needs_v46
|
|
\ir 0046_boundary_accounting_upgrade.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 46 AS needs_v47 FROM evolution.schema_migrations \gset
|
|
\if :needs_v47
|
|
\ir 0047_cellular_migration_freeze.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 47 AS needs_v48 FROM evolution.schema_migrations \gset
|
|
\if :needs_v48
|
|
\ir 0048_cellular_migration_staging.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 48 AS needs_v49 FROM evolution.schema_migrations \gset
|
|
\if :needs_v49
|
|
\ir 0049_cellular_migration_publication.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 49 AS needs_v50 FROM evolution.schema_migrations \gset
|
|
\if :needs_v50
|
|
\ir 0050_world_region_catalog.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 50 AS needs_v51 FROM evolution.schema_migrations \gset
|
|
\if :needs_v51
|
|
\ir 0051_database_history_domain.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 51 AS needs_v52 FROM evolution.schema_migrations \gset
|
|
\if :needs_v52
|
|
\ir 0052_census_pending_migrations.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 52 AS needs_v53 FROM evolution.schema_migrations \gset
|
|
\if :needs_v53
|
|
\ir 0053_funded_cellular_maturation.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 53 AS needs_v54 FROM evolution.schema_migrations \gset
|
|
\if :needs_v54
|
|
\ir 0054_maturing_cellular_migration.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 54 AS needs_v55 FROM evolution.schema_migrations \gset
|
|
\if :needs_v55
|
|
\ir 0055_retained_cellular_plans.sql
|
|
\endif
|
|
SELECT coalesce(max(version), 0) = 55 AS needs_v56 FROM evolution.schema_migrations \gset
|
|
\if :needs_v56
|
|
\ir 0056_cellular_environment_publication.sql
|
|
\endif
|
|
-- Effective-privilege audit on every run, including no-ops (ADR-0060). Attributes
|
|
-- alone are insufficient: predefined roles such as pg_write_all_data, PUBLIC
|
|
-- grants or SET-able memberships would bypass the fenced functions. Checks the
|
|
-- runtime group and every role that is (transitively) a member of it.
|
|
SELECT pg_catalog.set_config('evolution.runtime_role', :'runtime_role', true);
|
|
DO $$
|
|
DECLARE
|
|
runtime oid := (SELECT r.oid FROM pg_catalog.pg_roles r
|
|
WHERE r.rolname = pg_catalog.current_setting('evolution.runtime_role'));
|
|
bad text;
|
|
BEGIN
|
|
IF runtime IS NULL THEN
|
|
RAISE EXCEPTION 'runtime role does not exist';
|
|
END IF;
|
|
WITH RECURSIVE closure(oid) AS (
|
|
SELECT runtime
|
|
UNION
|
|
SELECT m.member FROM pg_catalog.pg_auth_members m JOIN closure c ON m.roleid = c.oid
|
|
), fenced(oid) AS (VALUES
|
|
('evolution.load_world_cellular_migrations_v1(evolution.u64)'::regprocedure::oid),
|
|
('evolution.load_history_domain_v1()'::regprocedure::oid),
|
|
('evolution.load_world_region_catalog_v1(evolution.u64)'::regprocedure::oid),
|
|
('evolution.publish_cellular_migration(uuid,bytea,bytea,uuid,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.load_cellular_migration_commit(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.stage_cellular_migration(evolution.u64,evolution.u64,uuid,evolution.u64,bytea,bytea,evolution.u64)'::regprocedure::oid),
|
|
('evolution.load_cellular_migration_stage(evolution.u64,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.prepare_cellular_migration_freeze(evolution.u64,evolution.u64,uuid,evolution.u64,bytea)'::regprocedure::oid),
|
|
('evolution.abort_cellular_migration_freeze(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.load_cellular_migration_freeze(evolution.u64,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.admit_population_interval(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,bytea,evolution.u64)'::regprocedure::oid),
|
|
('evolution.load_population_interval(evolution.u64,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.publish_population_checkpoint(bytea,bytea)'::regprocedure::oid),
|
|
('evolution.publish_population_profile_transition(bytea)'::regprocedure::oid),
|
|
('evolution.resolve_population_commit(evolution.u64,evolution.u64,uuid,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.load_population_evidence(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.publish_environment_checkpoint(bytea,bytea)'::regprocedure::oid),
|
|
('evolution.publish_environment_profile_transition(bytea)'::regprocedure::oid),
|
|
('evolution.resolve_environment_commit(evolution.u64,evolution.u64,uuid,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.load_environment_evidence(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.publish_primitive_checkpoint(bytea,bytea)'::regprocedure::oid),
|
|
('evolution.load_primitive_lives(evolution.u64,evolution.u64)'::regprocedure::oid),
|
|
('evolution.query_primitive_life(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,evolution.u64)'::regprocedure::oid),
|
|
('evolution.primitive_life_owner(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.reserve_primitive_life(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,evolution.u64,integer)'::regprocedure::oid),
|
|
('evolution.reserve_cellular_mutation(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,evolution.u64,evolution.u64,bytea)'::regprocedure::oid),
|
|
('evolution.load_pending_cellular_mutations(evolution.u64,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.reject_primitive_life(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,evolution.u64,smallint)'::regprocedure::oid),
|
|
('evolution.acquire_region_lease(evolution.u64,evolution.u64,integer)'::regprocedure::oid),
|
|
('evolution.acquire_region_lease(evolution.u64,evolution.u64,integer,bytea)'::regprocedure::oid),
|
|
('evolution.renew_region_lease(evolution.u64,evolution.u64,uuid,evolution.u64,integer)'::regprocedure::oid),
|
|
('evolution.release_region_lease(evolution.u64,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.load_region_head(evolution.u64,evolution.u64)'::regprocedure::oid),
|
|
('evolution.publish_region_checkpoint(bytea,bytea)'::regprocedure::oid),
|
|
('evolution.load_region_checkpoint(evolution.u64,evolution.u64)'::regprocedure::oid),
|
|
('evolution.resolve_region_commit(evolution.u64,evolution.u64,uuid,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.load_region_decisions(evolution.u64,evolution.u64)'::regprocedure::oid),
|
|
('evolution.pending_region_outbox(evolution.u64,evolution.u64,integer)'::regprocedure::oid),
|
|
('evolution.acknowledge_region_outbox(evolution.u64,evolution.u64,integer,integer,evolution.u64)'::regprocedure::oid),
|
|
('evolution.load_region_commit(evolution.u64,evolution.u64,evolution.u64)'::regprocedure::oid),
|
|
('evolution.claim_account_control(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,evolution.u64,integer)'::regprocedure::oid),
|
|
('evolution.renew_account_control(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,integer)'::regprocedure::oid),
|
|
('evolution.release_account_control(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.publish_region_checkpoint(bytea,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.resolve_region_commit(evolution.u64,evolution.u64,uuid,bytea,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.find_region_action(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.find_region_action_record(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.publish_cellular_checkpoint(bytea,bytea,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.resolve_cellular_region_commit(evolution.u64,evolution.u64,uuid,bytea,bytea,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.publish_cellular_mutation_checkpoint(bytea,bytea,bytea,bytea,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.resolve_cellular_mutation_commit(evolution.u64,evolution.u64,uuid,bytea,bytea,bytea,bytea,bytea,bytea)'::regprocedure::oid),
|
|
('evolution.load_cellular_mutation_publications(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.end_cellular_lives(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,bytea)'::regprocedure::oid),
|
|
('evolution.issue_account_grant(evolution.u64,text,text)'::regprocedure::oid),
|
|
('evolution.revoke_account_grants(evolution.u64,text,text)'::regprocedure::oid),
|
|
('evolution.load_cellular_publication_actions(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.load_cellular_publication_births(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.publish_cellular_profile_migration(bytea)'::regprocedure::oid),
|
|
('evolution.load_cellular_profile_migration(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.open_probe(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,bigint,bigint,bigint,evolution.u64)'::regprocedure::oid),
|
|
('evolution.save_probe(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,bigint,bigint,bigint)'::regprocedure::oid),
|
|
('evolution.prepare_probe_transfer(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,uuid,evolution.u64,bigint,bigint,bigint)'::regprocedure::oid),
|
|
('evolution.stage_probe_transfer(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.commit_probe_transfer(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.abort_probe_transfer(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.find_probe_transfer(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
|
|
('evolution.handoff_account_control(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,uuid,evolution.u64,integer)'::regprocedure::oid),
|
|
('evolution.incoming_probe_transfers(evolution.u64,evolution.u64,uuid,evolution.u64)'::regprocedure::oid),
|
|
('evolution.overdue_probe_transfers(evolution.u64,evolution.u64,uuid,evolution.u64,integer)'::regprocedure::oid)
|
|
), violations(role_oid, reason) AS (
|
|
SELECT r.oid, 'privileged attribute or owner identity' FROM pg_catalog.pg_roles r
|
|
JOIN closure c ON c.oid = r.oid
|
|
WHERE r.rolsuper OR r.rolcreaterole OR r.rolcreatedb OR r.rolreplication
|
|
OR r.rolbypassrls OR r.rolname = current_user
|
|
UNION ALL
|
|
-- Any membership outside the runtime closure (inherited or SET-able).
|
|
SELECT m.member, 'membership outside the runtime group' FROM pg_catalog.pg_auth_members m
|
|
JOIN closure c ON c.oid = m.member
|
|
WHERE m.roleid NOT IN (SELECT oid FROM closure)
|
|
UNION ALL
|
|
SELECT c.oid, 'table privilege in evolution schema' FROM closure c
|
|
CROSS JOIN pg_catalog.pg_class t
|
|
WHERE t.relnamespace = 'evolution'::regnamespace AND t.relkind IN ('r', 'p', 'v', 'm', 'S')
|
|
AND pg_catalog.has_table_privilege(c.oid, t.oid,
|
|
'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,REFERENCES,TRIGGER,MAINTAIN')
|
|
UNION ALL
|
|
SELECT c.oid, 'CREATE on schema or database' FROM closure c
|
|
WHERE pg_catalog.has_schema_privilege(c.oid, 'evolution', 'CREATE')
|
|
OR pg_catalog.has_database_privilege(c.oid, pg_catalog.current_database(), 'CREATE')
|
|
OR EXISTS (SELECT 1 FROM pg_catalog.pg_namespace n WHERE n.nspname = 'public'
|
|
AND pg_catalog.has_schema_privilege(c.oid, n.oid, 'CREATE'))
|
|
UNION ALL
|
|
-- Only listed fenced functions are executable; provisioning/internal are not.
|
|
SELECT c.oid, 'EXECUTE outside the fenced function set' FROM closure c
|
|
CROSS JOIN pg_catalog.pg_proc p
|
|
WHERE p.pronamespace = 'evolution'::regnamespace
|
|
AND p.oid NOT IN (SELECT oid FROM fenced)
|
|
AND pg_catalog.has_function_privilege(c.oid, p.oid, 'EXECUTE')
|
|
UNION ALL
|
|
SELECT runtime, 'missing EXECUTE on a fenced function' FROM fenced f
|
|
WHERE NOT pg_catalog.has_function_privilege(runtime, f.oid, 'EXECUTE')
|
|
)
|
|
SELECT pg_catalog.string_agg(DISTINCT v.reason, '; ') INTO bad FROM violations v;
|
|
IF bad IS NOT NULL THEN
|
|
-- Reasons only; no role names or connection details are printed.
|
|
RAISE EXCEPTION 'runtime role audit failed: %', bad;
|
|
END IF;
|
|
END $$;
|
|
COMMIT;
|