Files
rust-discovery/migrations/0030_customer_starter_workers.sql
T

14 lines
757 B
SQL

-- A bootstrap worker published with the operator's starter release for this customer.
-- The administrator's explicit per-customer rotation file takes precedence.
CREATE TABLE customer_starter_workers (
tenant_id uuid NOT NULL REFERENCES tenants,
platform text NOT NULL,
sha256 text NOT NULL CHECK(sha256 ~ '^[0-9a-f]{64}$'),
size_bytes bigint NOT NULL CHECK(size_bytes BETWEEN 1 AND 268435456),
PRIMARY KEY(tenant_id,platform)
);
ALTER TABLE customer_starter_workers ENABLE ROW LEVEL SECURITY;
ALTER TABLE customer_starter_workers FORCE ROW LEVEL SECURITY;
CREATE POLICY tenant_scope ON customer_starter_workers USING (tenant_id::text=current_setting('app.tenant_id',true));
GRANT SELECT,INSERT ON customer_starter_workers TO rmm_app;