mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
doc: explain how to use policies in migrations (#4141)
This commit is contained in:
6
examples/rls/schema.sql
Normal file
6
examples/rls/schema.sql
Normal 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);
|
||||
Reference in New Issue
Block a user