diff --git a/db/postgres/20261021130815_node_execution_policy.down.sql b/db/postgres/20261021130815_node_execution_policy.down.sql new file mode 100644 index 000000000..957e88f61 --- /dev/null +++ b/db/postgres/20261021130815_node_execution_policy.down.sql @@ -0,0 +1,7 @@ +-- Roll back policy readers and writers before removing their columns. +SET LOCAL lock_timeout = '1s'; +SET LOCAL statement_timeout = '5s'; + +ALTER TABLE node_status_snapshots + DROP COLUMN execution_policy, + DROP COLUMN execution_policy_received_at; diff --git a/db/postgres/20261021130815_node_execution_policy.up.sql b/db/postgres/20261021130815_node_execution_policy.up.sql new file mode 100644 index 000000000..8cff86442 --- /dev/null +++ b/db/postgres/20261021130815_node_execution_policy.up.sql @@ -0,0 +1,14 @@ +SET LOCAL lock_timeout = '1s'; +SET LOCAL statement_timeout = '5s'; + +ALTER TABLE node_status_snapshots + ADD COLUMN execution_policy JSONB, + ADD COLUMN execution_policy_received_at TIMESTAMPTZ, + ADD CONSTRAINT node_status_execution_policy_observation CHECK ( + (execution_policy IS NULL) = (execution_policy_received_at IS NULL) + ) NOT VALID; + +COMMENT ON COLUMN node_status_snapshots.execution_policy IS + 'Validated execution eligibility observation; NULL means unknown policy, not an empty allowlist'; +COMMENT ON COLUMN node_status_snapshots.execution_policy_received_at IS + 'Control-plane receipt time for this policy; inventory-only reports from older writers do not refresh it';