MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / get_full_migration_dir

Function get_full_migration_dir

sea-orm-cli/src/commands/migrate.rs:170–177  ·  view source on GitHub ↗

`get_full_migration_dir` looks for a `src` directory inside of `migration_dir` and appends that to the returned path if found. Otherwise, `migration_dir` can point directly to a directory containing the migrations. In that case, nothing is appended. This way, `src` doesn't need to be appended in the standard case where migrations are in their own crate. If the migrations are in a submodule of an

(migration_dir: &str)

Source from the content-addressed store, hash-verified

168/// migrations are in their own crate. If the migrations are in a submodule
169/// of another crate, `migration_dir` can point directly to that module.
170fn get_full_migration_dir(migration_dir: &str) -> PathBuf {
171 let without_src = Path::new(migration_dir).to_owned();
172 let with_src = without_src.join("src");
173 match () {
174 _ if with_src.is_dir() => with_src,
175 _ => without_src,
176 }
177}
178
179fn create_new_migration(migration_name: &str, migration_dir: &str) -> Result<(), Box<dyn Error>> {
180 let migration_filepath =

Callers 2

create_new_migrationFunction · 0.85
get_migrator_filepathFunction · 0.85

Calls 2

joinMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected