Revert a journaled table operation by its `migration_id`. Refused (nothing written) when any
const url = 'https://example.com/datanotes/operations/undo_migration/';const options = { method: 'POST', headers: { 'X-Datanotes-Actor': '{"harness":"my-script","model":"","session":"s-1"}', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"migration_id":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/datanotes/operations/undo_migration/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'X-Datanotes-Actor: {"harness":"my-script","model":"","session":"s-1"}' \ --data '{ "migration_id": "example" }'Revert a journaled table operation by its migration_id. Refused (nothing written) when any
touched note changed since; the conflicts are listed. Also refused when the revert would leave rows
breaking a CHECK that follows links or a ref_where / ref_by (rows it writes, or rows that link to
them), listed like the refusals of other writes with the way out (fix the row, or drop the rule).
The rules are those of the schema the revert puts back: undoing a rename_value / rename_column
puts the old names back with the rows, and a rule the revert puts back must hold on every row.
A batch is checked as a whole first (nothing written when refused), then reverted operation by
operation, from the last; when one finds a note changed since, those after it stay reverted
and a retry skips them. An undo is journaled like any operation: undoing it (the
migration_id of its answer; undoes names the operation undone) is a redo, whatever the operation (a batch included). The
revert is a new version (UNDO) in the transaction log; undoing a table’s rename or move takes
its whole log back to the old name, the versions made under the new one included.
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”JSON: on whose behalf the write is made, recorded in the journal (harness, model, session).
Example
{"harness":"my-script","model":"","session":"s-1"}Request Bodyrequired
Section titled “Request Bodyrequired”object
Example generated
{ "migration_id": "example"}Responses
Section titled “Responses”Done.
Result of undo_migration (HTTP 409 when refused, 500 when a write failed).
object
True when the operation was undone.
The operation: undo_migration, in the answer and in a refusal.
The operation undone.
Journal id of the undo itself (undo it to redo the operation).
Why it could not be undone (empty on success).
object
Note or file path.
Why the operation cannot proceed.
object
Vault path.
What went wrong.
Example
{ "op": "undo_migration"}Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Missing or wrong bearer token.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}A named token beyond its permissions (the engine’s administration, tables outside its write patterns, schema changes without ddl).
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Unknown table, view, migration, note or folder.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Undo refused (later changes depend on it, or it was undone already): nothing written (a batch is checked as a whole first; when one of its operations then finds a note changed since, the operations after it stay reverted: touched, and a retry skips them). Same body as 200, with ok: false.
Result of undo_migration (HTTP 409 when refused, 500 when a write failed).
object
True when the operation was undone.
The operation: undo_migration, in the answer and in a refusal.
The operation undone.
Journal id of the undo itself (undo it to redo the operation).
Why it could not be undone (empty on success).
object
Note or file path.
Why the operation cannot proceed.
object
Vault path.
What went wrong.
object
The tables’ folders the name matches.
The qualified tables the name matches.
Example
{ "op": "undo_migration"}Unexpected error ({error}), or a write that failed partway and could not be rolled back: rolled_back: false, failed lists the files left (undo_migration on migration_id retries the rollback).
Result of undo_migration (HTTP 409 when refused, 500 when a write failed).
object
True when the operation was undone.
The operation: undo_migration, in the answer and in a refusal.
The operation undone.
Journal id of the undo itself (undo it to redo the operation).
Why it could not be undone (empty on success).
object
Note or file path.
Why the operation cannot proceed.
object
Vault path.
What went wrong.
object
What went wrong, for a person or an agent.
Example
{ "op": "undo_migration"}