Add support for Postgres RLS policies
- Dominant language
- JavaScript
- Stars
- 3.7k
- Forks
- 233
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Enhancement.
It would be great to model RLS policies for Postgres with dbml and generate CREATE POLICY scripts with dbml2sql.
Suggested markup:
```
Policy {
name 'Users can take all actions on their own accounts'
schema public
table users
behavior permissive
command all
roles [authenticated]
using `auth.uid() = user_id`
check null
}
```
`schema` defaults to public if not provided.
`behavior` can have the values `permissive` or `restrictive`. It defaults to `permissive` if not provided.
`command` can have the values `select`, `insert`, `update`, `delete`, or `all`.
`roles` accepts a list of roles and defaults to `public` if none are provided.
`using` and `check` default to null if not provided.
Contributor guide
Assessment
This issue has not been assessed yet.