Skip to main content

run_introspection

Function run_introspection 

Source
pub fn run_introspection(
    connection: &ResolvedConnection,
    out_dir: &Path,
    init_metadata: bool,
    breakpoints: bool,
    introspect_casing: Option<IntrospectCasing>,
    filters: &SnapshotFilters,
    migrations_table: &str,
    migrations_schema: &str,
) -> Result<IntrospectResult, CliError>
Expand description

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).

The tracking table is excluded and filters applied before anything is written. With init_metadata, the baseline is then recorded as applied; without it, the baseline’s SQL is commented out, so migrate does not try to create what the database already has.

§Errors

Returns CliError if connecting or querying the catalogs fails, applying the filters fails, out_dir uses the legacy journal layout, a file cannot be written, or init_metadata is refused because migrations are already recorded or the folder holds more than one migration.