Apply a schema sync
apply_schema_syncCreate and update lists, indexes, write rules and flows to match a schema sync document. All or nothing: if any change would be refused, nothing is written and the plan says why. Run plan_schema_sync first and show the user the plan. With prune, it can also delete lists and indexes, so it needs confirmDestructive: true. Needs sync-schema plus the permission for each change; flows need a token that is allowed everything. Index builds it starts run in the background (wait_for_index). Suggest the user commits the document, so it can be deployed with jsonpad sync-schema. 1 request.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prune | No | Also delete the lists and indexes this document's scope manages but no longer declares. Needs a scope | |
| document | Yes | The schema sync document: { "$schema": "https://jsonpad.io/schema/sync-v1.json", "scope": "my-app", "lists": { "<pathName>": { name, schema, rules, rulesTests, indexes: { "<pathName>": { pointer, valueType, ... } } } }, "flows": { ... } }. File references (rulesFile and so on) aren't supported: put the contents inline | |
| allowRebuild | No | Allow changes that rebuild an index in a list that has items (the index is unusable until it's rebuilt) | |
| allowDestructive | No | Allow a prune to delete lists that have items, and guard indexes | |
| confirmDestructive | No | Confirm a prune, which can delete lists and indexes (after showing the user the plan) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| applied | Yes | ||
| changes | No | ||
| summary | No |