`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)
| 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. |
| 170 | fn 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 | |
| 179 | fn create_new_migration(migration_name: &str, migration_dir: &str) -> Result<(), Box<dyn Error>> { |
| 180 | let migration_filepath = |
no test coverage detected