doc: explain how to use policies in migrations (#4141)

This commit is contained in:
Ariel Mashraki
2024-07-14 14:53:22 +03:00
committed by GitHub
parent 1073ce511e
commit 9f61938bcc
37 changed files with 5768 additions and 7 deletions

6
examples/rls/schema.sql Normal file
View File

@@ -0,0 +1,6 @@
-- Enable row-level security on the users table.
ALTER TABLE "users" ENABLE ROW LEVEL SECURITY;
-- Create a policy that restricts access to rows in the users table based on the current tenant.
CREATE POLICY tenant_isolation ON "users"
USING ("tenant_id" = current_setting('app.current_tenant')::integer);