-- +goose Up -- Key-value storage for status page servers, which have no database of -- their own: TLS certificates and ACME account keys. Values are sealed by -- the application. Owner separates platform servers from each -- organization's servers so none can read another's private keys. CREATE TABLE agent_storage ( owner text NOT NULL, key text NOT NULL CHECK (length(key) BETWEEN 1 AND 1000), value bytea NOT NULL, modified timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (owner, key) ); -- Only reached through agent handlers in the system scope. ALTER TABLE agent_storage ENABLE ROW LEVEL SECURITY; ALTER TABLE agent_storage FORCE ROW LEVEL SECURITY; CREATE POLICY agent_storage_system ON agent_storage FOR ALL USING (app_scope_system()) WITH CHECK (app_scope_system()); -- +goose Down DROP TABLE agent_storage;