Type Alias: Migration
Migration =
object
Defined in: migrations/types.ts:76
Properties
description?
optionaldescription?:string
Defined in: migrations/types.ts:85
One paragraph on what it does and why sync could not. Shown by status.
isApplied?
optionalisApplied?: (context) =>Promise<boolean>
Defined in: migrations/types.ts:111
Whether the database already carries this migration's change, answered from the schema rather than from the ledger.
It exists for the database migrated before the ledger did: with no row to go on, the runner cannot tell "never ran" from "ran before anything was recorded", and would re-run it. A migration that can recognise its own work — the column it adds is there, the column it drops is gone — says so here, and the runner records it instead of running it.
Answer from the change itself, and only when the answer is certain: a probe that guesses wrong skips work that was never done. A migration that cannot tell (a data rewrite that leaves no trace) declares none, and the operator baselines it.
The context is always in dry-run mode, so a write from here is reported rather than performed.
Parameters
| Parameter | Type |
|---|---|
context | MigrationContext |
Returns
Promise<boolean>
name
name:
string
Defined in: migrations/types.ts:83
The identity of the migration in the ledger. Kebab-case by convention
(add-project-id). Renaming one after it has run anywhere makes the
runner refuse to start, because the ledger would hold a name nothing
declares.
options?
optionaloptions?:MigrationOption[]
Defined in: migrations/types.ts:86
up
up: (
context) =>Promise<void>
Defined in: migrations/types.ts:92
The migration. It must be idempotent: the ledger records what finished, not what half-ran, so a failed attempt is retried from the top on the next run.
Parameters
| Parameter | Type |
|---|---|
context | MigrationContext |
Returns
Promise<void>