ReferenceHTTP API
migrations
The migrations router: 13 methods of the migrations capability, with tier, scope, input and output.
Capability migrations · scope system · mode singleton · source packages/types/src/capabilities/migrations.cap.ts:28.
Every method is called at /trpc/migrations.<method> — queries with GET, mutations with POST. See How to call and Authorization.
| Method | Kind | Tier | Token scope | Viewer |
|---|---|---|---|---|
listLedger | query | admin | admin only | no |
listPending | query | admin | admin only | no |
dryRun | query | admin | admin only | no |
markFailed | mutation | admin | admin only | no |
retry | mutation | admin | admin only | no |
restorePreMigration | mutation | admin | admin only | no |
declareOwner | mutation | admin | admin only | no |
startMigration | mutation | admin | admin only | no |
finishMigration | mutation | admin | admin only | no |
readLegacyIntegrationRows | query | admin | admin only | no |
clearLegacyIntegrationRows | mutation | admin | admin only | no |
patchLegacyIntegrationRows | mutation | admin | admin only | no |
deleteLegacyIntegrationRowKeys | mutation | admin | admin only | no |
migrations.listLedger
- Kind: query —
GET /trpc/migrations.listLedger - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.listLedgeron your hub
Input
{}Output
{ entries: ({ id: string; database: DataStoreDatabaseSchema; owner: string; level: "hub-store" | "addon-state" | "node-config" | "viewer" | "addon-internal"; seq: number; status: "applied" | "failed" | "blocked" | "running" | "held" | "skipped-newer"; attempts: number; appliedAt: number | null; codeVersion: string | null; planSummary: Record<string, unknown> | null; progress: Record<string, unknown> | null; error: string | null; reason: string | null; nodeId: string | null; bootId: string | null; meta?: { id: string; owner: string; level: "hub-store" | "addon-state" | "node-config" | "viewer" | "addon-internal"; seq: number; dependsOn: string[]; store: "settings" | "events" | "history" | "node-local" | "addon-files"; scope: "cluster" | "per-node"; onFailure: "block-owner" | "tolerate"; bodyKind: "sql" | "plan" | "procedure"; description: string; fixtureMark: string }; ownerNotLoaded?: boolean })[] }Shapes: DataStoreDatabaseSchema
migrations.listPending
- Kind: query —
GET /trpc/migrations.listPending - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.listPendingon your hub
Input
{ owner?: string }Output
{ pending: ({ meta: { id: string; owner: string; level: "hub-store" | "addon-state" | "node-config" | "viewer" | "addon-internal"; seq: number; dependsOn: string[]; store: "settings" | "events" | "history" | "node-local" | "addon-files"; scope: "cluster" | "per-node"; onFailure: "block-owner" | "tolerate"; bodyKind: "sql" | "plan" | "procedure"; description: string; fixtureMark: string }; database: DataStoreDatabaseSchema; state: "pending" | "failed" | "blocked" | "held"; reason: string | null })[] }Shapes: DataStoreDatabaseSchema
migrations.dryRun
- Kind: query —
GET /trpc/migrations.dryRun - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.dryRunon your hub
Input
{ id: string }Output
{ id: string; ok: boolean; error: string | null; rowsChanged: number; tables: ({ table: string; before: number; after: number })[] }migrations.markFailed
- Kind: mutation —
POST /trpc/migrations.markFailed - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.markFailedon your hub
Input
{ id: string; error: string }Output
{ id: string; database: DataStoreDatabaseSchema; owner: string; level: "hub-store" | "addon-state" | "node-config" | "viewer" | "addon-internal"; seq: number; status: "applied" | "failed" | "blocked" | "running" | "held" | "skipped-newer"; attempts: number; appliedAt: number | null; codeVersion: string | null; planSummary: Record<string, unknown> | null; progress: Record<string, unknown> | null; error: string | null; reason: string | null; nodeId: string | null; bootId: string | null; meta?: { id: string; owner: string; level: "hub-store" | "addon-state" | "node-config" | "viewer" | "addon-internal"; seq: number; dependsOn: string[]; store: "settings" | "events" | "history" | "node-local" | "addon-files"; scope: "cluster" | "per-node"; onFailure: "block-owner" | "tolerate"; bodyKind: "sql" | "plan" | "procedure"; description: string; fixtureMark: string }; ownerNotLoaded?: boolean }Shapes: DataStoreDatabaseSchema
migrations.retry
- Kind: mutation —
POST /trpc/migrations.retry - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.retryon your hub
Input
{ id: string }Output
{ entries: ({ id: string; database: DataStoreDatabaseSchema; owner: string; level: "hub-store" | "addon-state" | "node-config" | "viewer" | "addon-internal"; seq: number; status: "applied" | "failed" | "blocked" | "running" | "held" | "skipped-newer"; attempts: number; appliedAt: number | null; codeVersion: string | null; planSummary: Record<string, unknown> | null; progress: Record<string, unknown> | null; error: string | null; reason: string | null; nodeId: string | null; bootId: string | null; meta?: { id: string; owner: string; level: "hub-store" | "addon-state" | "node-config" | "viewer" | "addon-internal"; seq: number; dependsOn: string[]; store: "settings" | "events" | "history" | "node-local" | "addon-files"; scope: "cluster" | "per-node"; onFailure: "block-owner" | "tolerate"; bodyKind: "sql" | "plan" | "procedure"; description: string; fixtureMark: string }; ownerNotLoaded?: boolean })[] }Shapes: DataStoreDatabaseSchema
migrations.restorePreMigration
- Kind: mutation —
POST /trpc/migrations.restorePreMigration - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.restorePreMigrationon your hub
Input
{ database: DataStoreDatabaseSchema; snapshotId: string }Output
{ scheduled: boolean; held: string[]; restartRequired: boolean }Shapes: DataStoreDatabaseSchema
migrations.declareOwner
- Kind: mutation —
POST /trpc/migrations.declareOwner - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.declareOwneron your hub
Input
{ owner: string; metas: ({ id: string; owner: string; level: "hub-store" | "addon-state" | "node-config" | "viewer" | "addon-internal"; seq: number; dependsOn: string[]; store: "settings" | "events" | "history" | "node-local" | "addon-files"; scope: "cluster" | "per-node"; onFailure: "block-owner" | "tolerate"; bodyKind: "sql" | "plan" | "procedure"; description: string; fixtureMark: string })[]; retired?: string[]; complete?: boolean }Output
{ bootId: string; snapshot: "none" | "written" | "refused"; steps: ({ id: string; action: "run" | "skip"; state: "pending" | "applied" | "failed" | "blocked" | "running" | "held" | "skipped-newer" })[]; migrationApi?: { version: number; methods: string[] } }migrations.startMigration
- Kind: mutation —
POST /trpc/migrations.startMigration - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.startMigrationon your hub
Input
{ id: string }Output
{ proceed: boolean; state: "pending" | "applied" | "failed" | "blocked" | "running" | "held" | "skipped-newer"; reason: string | null }migrations.finishMigration
- Kind: mutation —
POST /trpc/migrations.finishMigration - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.finishMigrationon your hub
Input
{ id: string; result: { kind: "plan"; plan: { edits: ({ op: "setKeys"; scope: string; values: Record<string, unknown>; precondition?: string } | { op: "deleteKeys"; scope: string; keys: string[]; precondition?: string } | { op: "putRow"; table: string; key: Record<string, unknown>; row: Record<string, unknown>; preconditionColumns?: string[]; precondition?: string } | { op: "deleteRow"; table: string; key: Record<string, unknown>; precondition?: string } | { op: "upsertRecord"; owner: string; kind: string; recordKey: string; deviceId?: number; at?: number; value: Record<string, unknown>; precondition?: string } | { op: "deleteRecord"; owner: string; kind: string; recordKey: string; precondition?: string } | { op: "rekeyDevice"; deviceId: number; addonId: string; stableId: string; precondition?: string } | { op: "tombstoneDevice"; deviceId: number; precondition?: string })[] } } | { kind: "procedure"; result: { outcome: "done" | "already-done"; summary: Record<string, unknown> } } | { kind: "failed"; error: string } }Output
{ status: "applied" | "failed" | "blocked" | "running" | "held" | "skipped-newer"; error: string | null; rowsChanged: number }migrations.readLegacyIntegrationRows
- Kind: query —
GET /trpc/migrations.readLegacyIntegrationRows - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.readLegacyIntegrationRowson your hub
Input
{ integrationId: string }Output
Record<string, unknown>migrations.clearLegacyIntegrationRows
- Kind: mutation —
POST /trpc/migrations.clearLegacyIntegrationRows - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.clearLegacyIntegrationRowson your hub
Input
{ integrationId: string }Output
{ rows: number; secrets: number }migrations.patchLegacyIntegrationRows
- Kind: mutation —
POST /trpc/migrations.patchLegacyIntegrationRows - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.patchLegacyIntegrationRowson your hub
Input
{ integrationId: string; patch: Record<string, unknown> }Output
{ written: boolean }migrations.deleteLegacyIntegrationRowKeys
- Kind: mutation —
POST /trpc/migrations.deleteLegacyIntegrationRowKeys - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=migrations.deleteLegacyIntegrationRowKeyson your hub
Input
{ integrationId: string; keys: string[] }Output
{ present: boolean; removed: Record<string, unknown> }