Skip to main content

Module db

Module db 

Source
Expand description

Live-database work for CLI commands: planning and applying migrations, planning and applying push, and introspection.

Each entry point dispatches on the resolved credentials to whichever driver features were compiled in.

Structs§

IntrospectResult
What run_introspection produced.
MigrationPlan
Planned migration execution details.
MigrationResult
What run_migrations did.
PushPlan
SQL that drizzle push would run, from plan_push.
SnapshotFilters
Optional filters for introspection and push planning.

Functions§

apply_push
Runs a PushPlan, asking for confirmation first when it is destructive and force is false.
apply_snapshot_filters
Apply table, schema, and extension filters to a snapshot in place.
execute_seed
Runs the statements of a seed in order, in one transaction where the driver supports it.
introspect_for_seed
Reads the live schema for drizzle seed: introspects the database, drops the migrations tracking table, and applies filters.
plan_migrations
Compares local migrations with the database’s tracking table without changing anything (migrate --plan / --verify).
plan_push
Plans a push: introspects the live database and diffs it against desired.
plan_push_with_renames
plan_push that lets resolve_renames settle rename-or-create questions before diffing.
run_introspection
Introspects a database and writes <out_dir>/schema.rs and a baseline <out_dir>/<tag>/ folder (snapshot.json and a migration.sql that creates the whole schema).
run_migrations
Applies the pending migrations in migrations_dir and records them in the tracking table, creating or upgrading that table as needed.