Skip to content

Commit

Permalink
Fix [cli] cargo publish failed
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 authored and tyt2y3 committed Feb 7, 2022
1 parent cd98137 commit 0a06892
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sea-orm-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,23 @@ fn run_migrate_command(matches: &ArgMatches<'_>) -> Result<(), Box<dyn Error>> {
println!("Initializing migration directory...");
macro_rules! write_file {
($filename: literal) => {
write_file!($filename, $filename);
};
($filename: literal, $template: literal) => {
let filepath = [&migration_dir, $filename].join("");
println!("Creating file `{}`", filepath);
let path = Path::new(&filepath);
let prefix = path.parent().unwrap();
fs::create_dir_all(prefix).unwrap();
let mut file = fs::File::create(path)?;
let content = include_str!(concat!("../template/migration/", $filename));
let content = include_str!(concat!("../template/migration/", $template));
file.write_all(content.as_bytes())?;
};
}
write_file!("src/lib.rs");
write_file!("src/m20220101_000001_create_table.rs");
write_file!("src/main.rs");
write_file!("Cargo.toml");
write_file!("Cargo.toml", "_Cargo.toml");
write_file!("README.md");
println!("Done!");
// Early exit!
Expand Down
File renamed without changes.

0 comments on commit 0a06892

Please sign in to comment.