Skip to main content

Module schema

Module schema 

Available on crate features tokio and turso only.
Expand description

Prefixed table names and forward schema migrations.

Migrations are tracked per prefix in a {prefix}schema_version table (not PRAGMA user_version), so several finmqtt instances - or finmqtt and the caller’s own tables - can share one database without clobbering each other’s version. migrate applies every pending migration in order, each in its own transaction.

To evolve the schema, append a function to MIGRATIONS; never edit or reorder existing entries. The index of an entry is the schema version it produces (entry 0 produces version 1).

StructsΒ§

Tables πŸ”’
The prefix-qualified table names. Small and reused across migrations, statement preparation, and queries.

ConstantsΒ§

MIGRATIONS πŸ”’
Ordered, append-only schema migrations. Entry i advances the schema to version i + 1.

FunctionsΒ§

apply πŸ”’
Applies one migration and records its version atomically.
apply_inner πŸ”’
current_version πŸ”’
Reads the recorded schema version, or 0 if none has been recorded yet.
initial_schema πŸ”’
Migration v1: the live-state tables plus the per-filter subscription table.
migrate πŸ”’
Applies every pending migration, bringing the schema up to the latest version. A no-op once the database is current.
pending_restore πŸ”’
Migration v2: rebuilds the filter table.
validate_prefix πŸ”’
Validates that prefix is safe to splice into table identifiers.