aboutsummaryrefslogtreecommitdiff
path: root/query/update.md
diff options
context:
space:
mode:
authorUMTS at Teleco <crt@teleco.ch>2026-02-15 15:53:50 +0100
committerUMTS at Teleco <crt@teleco.ch>2026-02-15 15:53:50 +0100
commitfa680b24d1123f9de27fc752943e43c86c692314 (patch)
treee4875712a0f8298819c490dc42e881218a2175bc /query/update.md
JAYSON DERULO
Diffstat (limited to 'query/update.md')
-rw-r--r--query/update.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/query/update.md b/query/update.md
new file mode 100644
index 0000000..2c5b753
--- /dev/null
+++ b/query/update.md
@@ -0,0 +1,54 @@
+# Update
+
+[back to query](README.md) /// [home](../README.md)
+
+Modify existing rows in a table.
+
+## Request
+
+```json
+{
+ "action": "update",
+ "table": "items",
+ "data": {
+ "price": 29.99,
+ "status": "active"
+ },
+ "filter": {
+ "column": "id",
+ "op": "=",
+ "value": 42
+ }
+}
+```
+
+## Fields
+
+| Field | Type | Required | Notes |
+|----------|--------|----------|------------------------------|
+| `action` | string | yes | must be `"update"` |
+| `table` | string | yes | target table |
+| `data` | object | yes | column value pairs to update |
+| `where` | object | yes* | simple key value filter |
+| `filter` | object | yes* | structured filter |
+
+*at least one of `where` or `filter` is required. you cant do an unfiltered update.
+
+## Response
+
+```json
+{
+ "success": true,
+ "rows_affected": 1
+}
+```
+
+## Behaviors
+
+- a WHERE clause is **mandatory**. the server refuses to run an update without one. this is a safety thingy yk
+- columns you dont have write access to are silently stripped. `warning` is included if json derulo stripped for you
+- `last_modified_by` auto set to your user ID
+- `last_modified_at` is handled by sqls ON UPDATE trigger
+- ownership scoping applies: if you have `rwo` you can only update rows where `pinned_to` equals your user ID uness you have rwa. same deal with `rwg` for group scoping
+- limit is applied if set and capped to your max
+- auto generation rules apply on update too if configured for the update action