Add cli feature on sea-orm-migration (#978)
* Add cli feature on sea-orm-migration * Add cli feature on sea-orm-cli * Remove async-std feature and add async-std in the default feature Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
This commit is contained in:
parent
cb76b8f443
commit
9f2eb3d46c
@ -23,15 +23,15 @@ path = "src/lib.rs"
|
||||
[[bin]]
|
||||
name = "sea-orm-cli"
|
||||
path = "src/bin/main.rs"
|
||||
required-features = ["codegen"]
|
||||
required-features = ["cli", "codegen"]
|
||||
|
||||
[[bin]]
|
||||
name = "sea"
|
||||
path = "src/bin/sea.rs"
|
||||
required-features = ["codegen"]
|
||||
required-features = ["cli", "codegen"]
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "^3.2", features = ["env", "derive"] }
|
||||
clap = { version = "^3.2", features = ["env", "derive"], optional = true }
|
||||
dotenvy = { version = "^0.15", optional = true }
|
||||
async-std = { version = "^1.9", features = ["attributes", "tokio1"], optional = true }
|
||||
sea-orm-codegen = { version = "^0.10.0", path = "../sea-orm-codegen", optional = true }
|
||||
@ -47,8 +47,9 @@ regex = "1"
|
||||
smol = "1.2.5"
|
||||
|
||||
[features]
|
||||
default = [ "codegen", "runtime-async-std-native-tls", "dotenvy", "async-std" ]
|
||||
default = ["codegen", "cli", "runtime-async-std-native-tls", "async-std"]
|
||||
codegen = ["sea-schema/sqlx-all", "sea-orm-codegen"]
|
||||
cli = ["clap", "dotenvy"]
|
||||
runtime-actix-native-tls = ["sqlx/runtime-actix-native-tls", "sea-schema/runtime-actix-native-tls"]
|
||||
runtime-async-std-native-tls = ["sqlx/runtime-async-std-native-tls", "sea-schema/runtime-async-std-native-tls"]
|
||||
runtime-tokio-native-tls = ["sqlx/runtime-tokio-native-tls", "sea-schema/runtime-tokio-native-tls"]
|
||||
|
@ -8,8 +8,10 @@ use std::{
|
||||
process::Command,
|
||||
};
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
use crate::MigrateSubcommands;
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
pub fn run_migrate_command(
|
||||
command: Option<MigrateSubcommands>,
|
||||
migration_dir: &str,
|
||||
|
@ -1,5 +1,7 @@
|
||||
#[cfg(feature = "cli")]
|
||||
pub mod cli;
|
||||
pub mod commands;
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
pub use cli::*;
|
||||
pub use commands::*;
|
||||
|
@ -21,10 +21,10 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
async-trait = { version = "^0.1" }
|
||||
clap = { version = "^3.2", features = ["env", "derive"] }
|
||||
dotenvy = { version = "^0.15" }
|
||||
clap = { version = "^3.2", features = ["env", "derive"], optional = true }
|
||||
dotenvy = { version = "^0.15", optional = true }
|
||||
sea-orm = { version = "^0.10.0", path = "../", default-features = false, features = ["macros"] }
|
||||
sea-orm-cli = { version = "^0.10.0", path = "../sea-orm-cli", default-features = false }
|
||||
sea-orm-cli = { version = "^0.10.0", path = "../sea-orm-cli", default-features = false, optional = true }
|
||||
sea-schema = { version = "^0.10.2", git = "https://github.com/SeaQL/sea-schema" }
|
||||
tracing = { version = "0.1", features = ["log"] }
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
@ -33,6 +33,8 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
async-std = { version = "^1", features = ["attributes", "tokio1"] }
|
||||
|
||||
[features]
|
||||
default = ["cli"]
|
||||
cli = ["clap", "dotenvy", "sea-orm-cli/cli"]
|
||||
sqlx-mysql = ["sea-orm/sqlx-mysql"]
|
||||
sqlx-postgres = ["sea-orm/sqlx-postgres"]
|
||||
sqlx-sqlite = ["sea-orm/sqlx-sqlite"]
|
||||
|
@ -1,3 +1,4 @@
|
||||
#[cfg(feature = "cli")]
|
||||
pub mod cli;
|
||||
pub mod manager;
|
||||
pub mod migrator;
|
||||
|
@ -1,4 +1,6 @@
|
||||
#[cfg(feature = "cli")]
|
||||
pub use super::cli;
|
||||
|
||||
pub use super::manager::SchemaManager;
|
||||
pub use super::migrator::MigratorTrait;
|
||||
pub use super::{MigrationName, MigrationTrait};
|
||||
|
Loading…
x
Reference in New Issue
Block a user