Skip to main content

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

FieldTypeRequiredDefaultDescriptionConstraints
allowBreakingbooleanNoRun statements that are not additive. Default false.
approvalIdstring (nullable)NoThe planId a person other than the caller approved, for a breaking file in a production target.
catalogstringYesThe catalog the migration tables live in; the ledger is stardelt_meta in it.
filesarray of objectYesEvery migration file of the bundle; the answer runs the new ones in name order.
files[].namestringYesNNN_<words>.sql: three digits, an underscore, lower-case words, .sql.
files[].sha256stringYesThe file's sha256, 64 lower-case hex digits.
files[].sqlstringYes
modestringNoThe bundle target's mode (targets.<target>.mode in bundle.yaml): development or production. Client-declared, like allowBreaking.
targetstringYesThe bundle target whose ledger rows count (dev, prod, …).

Responses

CodeDescription
200What ran and what the ledger already had
400A malformed request, or a statement the engine refused: one sentence
401No token to sign in with
409Refused before anything ran: a changed or reordered file (ApplyAnswer with the errors), or a breaking file without allowBreaking (one sentence)
502The 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

FieldTypeRequiredDefaultDescriptionConstraints
planIdstringYesThe planId a plan answered with.

Responses

CodeDescription
200The recorded approval: who approved and when
400A malformed request, one sentence
401No token to sign in with
404No such plan: it was never planned on this Nova, or the state store was reset
409The caller is the plan's author: a second person has to approve it
503The 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

FieldTypeRequiredDefaultDescriptionConstraints
catalogstringYesThe catalog the sink tables live in; the ledger is stardelt_meta in it.
filesarray of objectYesEvery migration file of the bundle, in any order; the answer sorts them by name.
files[].namestringYesNNN_<words>.sql: three digits, an underscore, lower-case words, .sql.
files[].sha256stringYesThe file's sha256, 64 lower-case hex digits.
files[].sqlstringYes
targetstringYesThe bundle target whose ledger rows count (dev, prod, …).

Responses

CodeDescription
200The plan: per file, class and status, plus the problems
400A malformed request, one sentence
401No token to sign in with
502The query engine is not reachable