-- One instance-wide policy version, bumped inside the transaction of every -- policy write, so a process that authorizes can tell before each decision -- whether its engine is current. Per-level counters cannot carry that: an edit -- outside the level that currently holds the highest version is invisible, a -- delete can move the highest version down, and an instance reset writes no -- version at all. A singleton row, because access_policy_versions.level only -- admits the real levels. -- +goose Up CREATE TABLE access_policy_revision ( only_row boolean PRIMARY KEY DEFAULT true CHECK (only_row), version bigint NOT NULL DEFAULT 1, updated_at timestamptz NOT NULL DEFAULT now() ); INSERT INTO access_policy_revision (only_row) VALUES (true); -- +goose Down DROP TABLE access_policy_revision;