Patch Schema
patch_schemaChange PART of a project's schema without dropping any of it (saves to database, does NOT deploy).
Send only the change. The server applies it to the saved schema, in order and all together, and keeps every table and field it does not touch — including their identity, so a rename stays a rename and the column keeps its data.
OPERATIONS (each one small object, applied in the order given): • {"op": "add_table", "table": "clocks", "definition": {...}} new table, same FLAT rules as create_project • {"op": "rename_table", "table": "clocks", "to": "timers"} • {"op": "add_field", "table": "assets", "field": "serial", "definition": {"type": "string", "max_length": 64}} • {"op": "rename_field", "table": "parameters", "field": "is_clock", "to": "clock_kind"} • {"op": "set_field", "table": "assets", "field": "name", "properties": {"max_length": 300}} merges; a property set to null is removed • {"op": "set_table", "table": "assets", "properties": {"audit": true}} policy, constraints, audit, admin_write
Dropping a table or field is drop_schema_items, a tool of its own.
ALL OR NOTHING: an operation that cannot be applied — a table or field that is not there, a name already taken, a schema the deploy would refuse — refuses the whole patch, naming the operation, and nothing is saved.
EVERY ANSWER IS A DIFF: 'applied' (what each operation did), 'diff' (every changed property by path), 'summary' and 'plan' (the migration a deploy would then run), and 'version' (the schema's version after the change).
WORKFLOW:
get_schema with tables/fields to read the part you are changing (its 'version' is the whole schema's)
preview_schema_change with the operations: check 'diff' and 'plan'
patch_schema with the same operations (pass expected_version to be refused if someone else saved meanwhile)
deploy_staging, then get_job_status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operations | Yes | The operations, applied in order and all together. See the tool description for every op and its fields. | |
| project_id | Yes | Project ID (UUID) | |
| expected_version | No | The 'version' a get_schema read answered. The patch is refused (409) when the saved schema changed since, so two editors never overwrite each other silently. |