Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/store-sqlite / / Migration

Interface: Migration

Defined in: packages/store-sqlite/src/migrations/registry.ts:20

Single source of truth for the bundled migration SQL files. The runner loads them in numeric order, applies them inside a single transaction, and records the applied version in schema_migrations.

Bundled migrations live alongside this file (*.sql) and are read at package load time. The file name format is mandatory: NNN-<slug>.sql, where NNN is a zero-padded sequence number.

Future packages register additional migrations by appending entries to registerMigration during their package initialization.

Stable

Properties

PropertyModifierTypeDescriptionDefined in
namereadonlystringHuman-readable slug, e.g. 'memory'.packages/store-sqlite/src/migrations/registry.ts:24
ownerreadonlystringOwning module - surfaced in error messages.packages/store-sqlite/src/migrations/registry.ts:28
preflight?readonly(conn) => voidW-111: optional data-repair hook. The runner invokes it INSIDE the migration's transaction, immediately BEFORE sql, and only when the migration is actually pending. It exists so a migration whose DDL cannot tolerate pre-existing bad data (e.g. a CREATE UNIQUE INDEX over rows that already contain duplicates) can repair that data first WITHOUT editing the SQL file - the file stays byte-identical, so the checksum tamper-guard keeps holding for databases that already applied the version.packages/store-sqlite/src/migrations/registry.ts:39
sqlreadonlystringRaw SQL body (multi-statement).packages/store-sqlite/src/migrations/registry.ts:26
versionreadonlystringZero-padded sequence number - must be globally unique.packages/store-sqlite/src/migrations/registry.ts:22