Skip to content

Commit 137465a

Browse files
committed
docs: remove obsolete section "Advanced: RLS and SQLite Sync"
1 parent f700c6b commit 137465a

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

sqlite-cloud/platform/rls.mdx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -254,24 +254,3 @@ OLD.status <> 'paid'
254254

255255
**Explanation:**
256256
This policy uses the `OLD` reference to check the value of the `status` column *before* the update is applied. If the status is already `'paid'`, the condition `OLD.status <> 'paid'` will be false, and the `UPDATE` operation will be denied. This effectively makes paid invoices read-only.
257-
258-
259-
---
260-
261-
## Advanced: RLS and SQLite Sync
262-
263-
When using RLS in conjunction with <a href="https://github.com/sqliteai/sqlite-sync" target="_blank">SQLite Sync</a>, it's important to understand how they interact. The Sync protocol applies changes on a column-by-column basis, which can affect how `INSERT` and `UPDATE` policies are evaluated.
264-
265-
To accommodate this, SQLite Cloud offers two modes for handling RLS during sync operations, configurable via the `rls_mode` server setting using the SQLite Cloud builtin command `SET KEY rls_mode TO <value>`.
266-
267-
#### Default Mode (`rls_mode = 1`)
268-
269-
To simplify policy creation for the most common use cases, the default mode does **not** enforce `INSERT` and `UPDATE` policies while applying changes from SQLite Sync.
270-
271-
Instead, after the sync operation is complete, the `SELECT` policy is used to validate the final state of the row. If the user does not have permission to view the resulting row, the entire transaction is rolled back. This ensures that users cannot introduce changes that they are not allowed to see.
272-
273-
#### Manual Policy Mode (`rls_mode = 0`)
274-
275-
For more complex scenarios, such as implementing separate read/write permissions or restricting write access to specific columns, you can set `rls_mode` to `0`.
276-
277-
In this mode, your `INSERT` and `UPDATE` policies are enforced for every incremental change applied by SQLite Sync. Because of Sync's column-by-column operation, your policies must be written to permit intermediate states. This means the policies must allow `NEW` values for non-primary key columns to be temporarily set to their default values during the sync process.

0 commit comments

Comments
 (0)