Skip to main content

load_dir

Function load_dir 

Source
pub fn load_dir(dir: &Path) -> Result<MigrationGraph>
Expand description

Walk dir and load all NNNN_*.json sidecar files into a sorted MigrationGraph.

Only files whose stems match the four-digit prefix pattern ([0-9][0-9][0-9][0-9]_*) and whose extension is .json are loaded. .py files and any other non-matching files are skipped. The resulting MigrationGraph is sorted by file stem (lexicographic / discovery order), which matches Python’s discover() sort.

This is the dir-native loader consumed by the Rust CLI (sub-C distribution). It does not invoke Python, does not exec_module, and opens no transaction.

§Errors

Returns MigrationError::Loader when the directory cannot be read or a matching sidecar file cannot be read or deserialized.