-
-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Export main() of sea-orm-cli (#1889) * Fix compile error: require "codegen" feature for main()
- Loading branch information
Showing
3 changed files
with
38 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,4 @@ | ||
use clap::Parser; | ||
use dotenvy::dotenv; | ||
use sea_orm_cli::{handle_error, run_generate_command, run_migrate_command, Cli, Commands}; | ||
|
||
#[async_std::main] | ||
async fn main() { | ||
dotenv().ok(); | ||
|
||
let cli = Cli::parse(); | ||
let verbose = cli.verbose; | ||
|
||
match cli.command { | ||
Commands::Generate { command } => { | ||
run_generate_command(command, verbose) | ||
.await | ||
.unwrap_or_else(handle_error); | ||
} | ||
Commands::Migrate { | ||
migration_dir, | ||
database_schema, | ||
database_url, | ||
command, | ||
} => run_migrate_command( | ||
command, | ||
&migration_dir, | ||
database_schema, | ||
database_url, | ||
verbose, | ||
) | ||
.unwrap_or_else(handle_error), | ||
} | ||
sea_orm_cli::main().await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,6 @@ | ||
//! COPY FROM bin/main.rs | ||
use clap::Parser; | ||
use dotenvy::dotenv; | ||
use sea_orm_cli::{handle_error, run_generate_command, run_migrate_command, Cli, Commands}; | ||
|
||
#[async_std::main] | ||
async fn main() { | ||
dotenv().ok(); | ||
|
||
let cli = Cli::parse(); | ||
let verbose = cli.verbose; | ||
|
||
match cli.command { | ||
Commands::Generate { command } => { | ||
run_generate_command(command, verbose) | ||
.await | ||
.unwrap_or_else(handle_error); | ||
} | ||
Commands::Migrate { | ||
migration_dir, | ||
database_schema, | ||
database_url, | ||
command, | ||
} => run_migrate_command( | ||
command, | ||
&migration_dir, | ||
database_schema, | ||
database_url, | ||
verbose, | ||
) | ||
.unwrap_or_else(handle_error), | ||
} | ||
sea_orm_cli::main().await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters