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

Function test_create_new_migration

sea-orm-cli/src/commands/migrate.rs:280–295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

278
279 #[test]
280 fn test_create_new_migration() {
281 let migration_name = "test_name";
282 let migration_dir = "/tmp/sea_orm_cli_test_new_migration/";
283 fs::create_dir_all(format!("{migration_dir}src")).unwrap();
284 create_new_migration(migration_name, migration_dir).unwrap();
285 let migration_filepath = Path::new(migration_dir)
286 .join("src")
287 .join(format!("{migration_name}.rs"));
288 assert!(migration_filepath.exists());
289 let migration_content = fs::read_to_string(migration_filepath).unwrap();
290 assert_eq!(
291 &migration_content,
292 include_str!("../../template/migration/src/m20220101_000001_create_table.rs")
293 );
294 fs::remove_dir_all("/tmp/sea_orm_cli_test_new_migration/").unwrap();
295 }
296
297 #[test]
298 fn test_update_migrator() {

Callers

nothing calls this directly

Calls 4

create_new_migrationFunction · 0.85
unwrapMethod · 0.80
joinMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected