Edit a draft merge
Saves the resolutions, own steps, acknowledgements and options of a draft or rehearsed merge. A save of only acknowledgements and options.after keeps the merge as it is (a rehearsed merge stays rehearsed). Any other save (resolutions, steps, options.lock_timeout_ms) moves it to computing (a rehearsed one loses its rehearsal): the worker recomputes the analysis and the plan from what was saved, keeping a resolution whose conflict is unchanged, and returns it to draft. version must be the one you last read.
Authorization
bearer In: header
Path Parameters
Database id
uuidMerge id
uuidRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Every field but version is optional; a missing one stays as it is.
The version you last saw; another one is a 409 merge_version_conflict.
int64Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/merges/497f6eca-6276-4993-bfeb-53cbbbba6f08" \ -H "Content-Type: application/json" \ -d '{ "version": 0 }'{ "acknowledgements": [ "string" ], "analysis": {}, "base_fingerprint": "string", "created_at": "2019-08-24T14:15:22Z", "created_by": "string", "database": "string", "direction": "into_parent", "error": "string", "failed_phase": "string", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "options": {}, "plan": {}, "rebaselined": true, "rehearsal": {}, "resolutions": [ { "choice": "keep_target", "conflict": "string" } ], "result": {}, "source_branch_id": "345f76de-8f9d-4a8f-b08e-a28a3db17483", "source_fingerprint": "string", "status": "computing", "steps": [ { "after": "string", "id": "string", "sql": "string" } ], "target_branch_id": "2a8880d3-8c08-4fef-81e0-ec9d6c6def29", "target_fingerprint": "string", "updated_at": "2019-08-24T14:15:22Z", "version": 0}Read a merge GET
The merge with its analysis (every changed object, the conflicts with base, target and source side by side), the plan, the last rehearsal, the result and the log. Poll it while the status is `computing`, `rehearsing`, `applying`, `online` or `finishing`, and while a requested after-merge choice is pending (`result.after.requested` or `started`).
Give up a merge that failed half applied POST
For a merge `failed` in the `online` phase: its transaction is on the target, its online steps didn't all run, and it holds both branches until it is retried to the end or abandoned. Abandoning makes it `cancelled` and frees the branches. Nothing on the target is undone: `result.leftovers` lists what the merge left there that the online phase didn't finish, each `{kind, schema, table, name}`: `not_valid_constraint` (a constraint added `NOT VALID`, never validated; it still checks new rows); `not_null_check` (a temporary `chelabase_merge_nn_*` check that wasn't dropped); `invalid_index` (the index the online phase was building, or dropping concurrently, when it stopped: Postgres may have left it INVALID, unused by queries but still updated by writes; it may also not be there); `unattached_index` (a valid index the merge built that its next step didn't put into place: a temporary `chelabase_merge_ix_*` index not renamed over the one it replaces, or a unique constraint's index not attached to its constraint; nothing uses it, and it costs on every write). Validate, attach or drop them by hand (`DROP INDEX CONCURRENTLY IF EXISTS` for an index).