26 lines
1.5 KiB
SQL
26 lines
1.5 KiB
SQL
-- The GUC is transaction-local and supplied only by trusted server code.
|
|
-- RLS is a defense against missing tenant predicates, not authentication.
|
|
ALTER TABLE opt_credit_accounts ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE opt_credit_accounts FORCE ROW LEVEL SECURITY;
|
|
CREATE POLICY opt_credit_accounts_tenant ON opt_credit_accounts
|
|
USING (tenant_id = current_setting('app.opt_credit_tenant_id', true))
|
|
WITH CHECK (tenant_id = current_setting('app.opt_credit_tenant_id', true));
|
|
|
|
ALTER TABLE opt_credit_reservations ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE opt_credit_reservations FORCE ROW LEVEL SECURITY;
|
|
CREATE POLICY opt_credit_reservations_tenant ON opt_credit_reservations
|
|
USING (tenant_id = current_setting('app.opt_credit_tenant_id', true))
|
|
WITH CHECK (tenant_id = current_setting('app.opt_credit_tenant_id', true));
|
|
|
|
ALTER TABLE opt_credit_events ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE opt_credit_events FORCE ROW LEVEL SECURITY;
|
|
CREATE POLICY opt_credit_events_tenant ON opt_credit_events
|
|
USING (tenant_id = current_setting('app.opt_credit_tenant_id', true))
|
|
WITH CHECK (tenant_id = current_setting('app.opt_credit_tenant_id', true));
|
|
|
|
ALTER TABLE opt_credit_purchases ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE opt_credit_purchases FORCE ROW LEVEL SECURITY;
|
|
CREATE POLICY opt_credit_purchases_tenant ON opt_credit_purchases
|
|
USING (tenant_id = current_setting('app.opt_credit_tenant_id', true))
|
|
WITH CHECK (tenant_id = current_setting('app.opt_credit_tenant_id', true));
|