Skip to main content

Module schema

Module schema 

Source
Expand description

Embedded database migrations and schema version tracking.

Migrations are defined as SQL strings and executed in order at startup when [database].run_migrations = true. The schema_version table tracks which migrations have been applied.

Each migration is idempotent: CREATE TABLE IF NOT EXISTS and CREATE INDEX IF NOT EXISTS are used throughout so that re-running migrations on an already-initialized database is a no-op.

Dialect-specific constants are selected at runtime based on DbKind.

Constants§

SCHEMA_VERSION
Current schema version. Increment this when adding new migrations.

Functions§

run_migrations
Run all pending migrations.