Skip to main content

ensure_schema

Function ensure_schema 

Source
pub fn ensure_schema(conn: &Connection) -> Result<()>
Expand description

Ensure the database schema is up to date, running any pending migrations.

Safe to call on:

  • A brand-new empty database (applies all migrations from scratch).
  • An existing database without version tracking (detects v1 tables, starts from v1 so existing data is preserved).
  • An already fully-migrated database (fast no-op path).