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]]
|
[[bin]]
|
||||||
name = "sea-orm-cli"
|
name = "sea-orm-cli"
|
||||||
path = "src/bin/main.rs"
|
path = "src/bin/main.rs"
|
||||||
required-features = ["codegen"]
|
required-features = ["cli", "codegen"]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "sea"
|
name = "sea"
|
||||||
path = "src/bin/sea.rs"
|
path = "src/bin/sea.rs"
|
||||||
required-features = ["codegen"]
|
required-features = ["cli", "codegen"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "^3.2", features = ["env", "derive"] }
|
clap = { version = "^3.2", features = ["env", "derive"], optional = true }
|
||||||
dotenvy = { version = "^0.15", optional = true }
|
dotenvy = { version = "^0.15", optional = true }
|
||||||
async-std = { version = "^1.9", features = ["attributes", "tokio1"], 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 }
|
sea-orm-codegen = { version = "^0.10.0", path = "../sea-orm-codegen", optional = true }
|
||||||
@ -47,8 +47,9 @@ regex = "1"
|
|||||||
smol = "1.2.5"
|
smol = "1.2.5"
|
||||||
|
|
||||||
[features]
|
[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"]
|
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-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-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"]
|
runtime-tokio-native-tls = ["sqlx/runtime-tokio-native-tls", "sea-schema/runtime-tokio-native-tls"]
|
||||||
|
@ -8,8 +8,10 @@ use std::{
|
|||||||
process::Command,
|
process::Command,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "cli")]
|
||||||
use crate::MigrateSubcommands;
|
use crate::MigrateSubcommands;
|
||||||
|
|
||||||
|
#[cfg(feature = "cli")]
|
||||||
pub fn run_migrate_command(
|
pub fn run_migrate_command(
|
||||||
command: Option<MigrateSubcommands>,
|
command: Option<MigrateSubcommands>,
|
||||||
migration_dir: &str,
|
migration_dir: &str,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
#[cfg(feature = "cli")]
|
||||||
pub mod cli;
|
pub mod cli;
|
||||||
pub mod commands;
|
pub mod commands;
|
||||||
|
|
||||||
|
#[cfg(feature = "cli")]
|
||||||
pub use cli::*;
|
pub use cli::*;
|
||||||
pub use commands::*;
|
pub use commands::*;
|
||||||
|
@ -21,10 +21,10 @@ path = "src/lib.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { version = "^0.1" }
|
async-trait = { version = "^0.1" }
|
||||||
clap = { version = "^3.2", features = ["env", "derive"] }
|
clap = { version = "^3.2", features = ["env", "derive"], optional = true }
|
||||||
dotenvy = { version = "^0.15" }
|
dotenvy = { version = "^0.15", optional = true }
|
||||||
sea-orm = { version = "^0.10.0", path = "../", default-features = false, features = ["macros"] }
|
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" }
|
sea-schema = { version = "^0.10.2", git = "https://github.com/SeaQL/sea-schema" }
|
||||||
tracing = { version = "0.1", features = ["log"] }
|
tracing = { version = "0.1", features = ["log"] }
|
||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
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"] }
|
async-std = { version = "^1", features = ["attributes", "tokio1"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["cli"]
|
||||||
|
cli = ["clap", "dotenvy", "sea-orm-cli/cli"]
|
||||||
sqlx-mysql = ["sea-orm/sqlx-mysql"]
|
sqlx-mysql = ["sea-orm/sqlx-mysql"]
|
||||||
sqlx-postgres = ["sea-orm/sqlx-postgres"]
|
sqlx-postgres = ["sea-orm/sqlx-postgres"]
|
||||||
sqlx-sqlite = ["sea-orm/sqlx-sqlite"]
|
sqlx-sqlite = ["sea-orm/sqlx-sqlite"]
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#[cfg(feature = "cli")]
|
||||||
pub mod cli;
|
pub mod cli;
|
||||||
pub mod manager;
|
pub mod manager;
|
||||||
pub mod migrator;
|
pub mod migrator;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
#[cfg(feature = "cli")]
|
||||||
pub use super::cli;
|
pub use super::cli;
|
||||||
|
|
||||||
pub use super::manager::SchemaManager;
|
pub use super::manager::SchemaManager;
|
||||||
pub use super::migrator::MigratorTrait;
|
pub use super::migrator::MigratorTrait;
|
||||||
pub use super::{MigrationName, MigrationTrait};
|
pub use super::{MigrationName, MigrationTrait};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user