Nova API — /api/migrations
The operations Nova tags public under /api/migrations. Generated from reference-src/nova-openapi.json.
POST /api/migrations/apply
Operation id migrations_apply: in Python client.call("migrations_apply", …), on the command line stardelt api migrations_apply.
Run a bundle's new migration files against one target, once each, and record them in stardelt_meta.migrations in that catalog. Files already applied with the same sha256 are skipped; a file whose content changed after it was applied, or a new file that sorts before an applied one, is refused (409). Statements that are not additive need allowBreaking. The statements and the ledger writes run as the caller, so the caller's catalog privileges apply.
Request body
| Field | Type | Required | Default | Description | Constraints |
|---|---|---|---|---|---|
allowBreaking | boolean | No | Run statements that are not additive. Default false. | ||
approvalId | string (nullable) | No | The planId a person other than the caller approved, for a breaking file in a production target. | ||
catalog | string | Yes | The catalog the migration tables live in; the ledger is stardelt_meta in it. | ||
files | array of object | Yes | Every migration file of the bundle; the answer runs the new ones in name order. | ||
files[].name | string | Yes | NNN_<words>.sql: three digits, an underscore, lower-case words, .sql. | ||
files[].sha256 | string | Yes | The file's sha256, 64 lower-case hex digits. | ||
files[].sql | string | Yes | |||
mode | string | No | The bundle target's mode (targets.<target>.mode in bundle.yaml): development or production. Client-declared, like allowBreaking. | ||
target | string | Yes | The bundle target whose ledger rows count (dev, prod, …). |
Responses
| Code | Description |
|---|---|
200 | What ran and what the ledger already had |
400 | A malformed request, or a statement the engine refused: one sentence |
401 | No token to sign in with |
409 | Refused before anything ran: a changed or reordered file (ApplyAnswer with the errors), or a breaking file without allowBreaking (one sentence) |
502 | The query engine is not reachable |
POST /api/migrations/approve
Operation id migrations_approve: in Python client.call("migrations_approve", …), on the command line stardelt api migrations_approve.
POST /api/migrations/approve — a second person says yes to a plan.
Record that the caller has looked at a migration plan, so a breaking change may run in a production target. The body is the planId a plan answered with. The plan's own author cannot approve it: a second person has to. Repeating a call is a no-op that answers the same row with the first approval time. Plans and approvals live in the state store.
Request body
| Field | Type | Required | Default | Description | Constraints |
|---|---|---|---|---|---|
planId | string | Yes | The planId a plan answered with. |
Responses
| Code | Description |
|---|---|
200 | The recorded approval: who approved and when |
400 | A malformed request, one sentence |
401 | No token to sign in with |
404 | No such plan: it was never planned on this Nova, or the state store was reset |
409 | The caller is the plan's author: a second person has to approve it |
503 | The state store is not configured |
POST /api/migrations/plan
Operation id migrations_plan: in Python client.call("migrations_plan", …), on the command line stardelt api migrations_plan.
What a bundle's migration files would do to one target, and what already ran there. Writes nothing. The body is catalog, target and files (name NNN_<words>.sql, sha256, sql); class is additive when every statement only creates or adds columns or views, else breaking with the first non-additive statement in reason; status is new, applied (same sha256 in stardelt_meta.migrations) or changed (applied with another sha256). ok is false, with one sentence per problem in errors, when a file changed after it was applied or a new file sorts before an applied one. ledger is false on a catalog whose stardelt_meta.migrations does not exist yet. planId names exactly the files that would run, and is what approve takes; approvable is false when no state store is configured. The ledger is read as the caller, so the caller's own catalog privileges decide what can be read. Answers Cache-Control: no-store.
Request body
| Field | Type | Required | Default | Description | Constraints |
|---|---|---|---|---|---|
catalog | string | Yes | The catalog the sink tables live in; the ledger is stardelt_meta in it. | ||
files | array of object | Yes | Every migration file of the bundle, in any order; the answer sorts them by name. | ||
files[].name | string | Yes | NNN_<words>.sql: three digits, an underscore, lower-case words, .sql. | ||
files[].sha256 | string | Yes | The file's sha256, 64 lower-case hex digits. | ||
files[].sql | string | Yes | |||
target | string | Yes | The bundle target whose ledger rows count (dev, prod, …). |
Responses
| Code | Description |
|---|---|
200 | The plan: per file, class and status, plus the problems |
400 | A malformed request, one sentence |
401 | No token to sign in with |
502 | The query engine is not reachable |