Expand description
Module database utilities
Each module has its own database at {data_dir}/db/. Use this helper to open it.
Modules use the same format as the node by default (via MODULE_CONFIG_DATABASE_BACKEND).
Structs§
- Migration
Context - Context passed to migration functions. Provides put/get/delete against the module’s schema tree and access to the database for opening other trees.
Functions§
- open_
module_ db - Open the module’s database at
{data_dir}/db/. - run_
migrations - Run pending up migrations. Opens the “schema” tree, reads current version, runs each migration with version > current in order, then updates schema_version.
- run_
migrations_ down - Rollback migrations down to
target_version(exclusive). Runs down migrations in reverse order for each applied version > target_version. Requires down functions to be provided. - run_
migrations_ with_ down - Run pending up migrations. Supports optional down migrations for rollback.
Type Aliases§
- Migration
- Migration pair: (version, up, optional down for rollback).
- Migration
Down - A single down migration step (for rollback).
- Migration
Up - A single up migration step.