Skip to content

Commit

Permalink
Add cli feature on sea-orm-migration (#978)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Rheydskey and billy1624 committed Oct 26, 2022
1 parent cb76b8f commit 9f2eb3d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 26 deletions.
31 changes: 16 additions & 15 deletions sea-orm-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
[package]
name = "sea-orm-cli"
version = "0.10.0"
authors = [ "Billy Chan <ccw.billy.123@gmail.com>" ]
authors = ["Billy Chan <ccw.billy.123@gmail.com>"]
edition = "2021"
description = "Command line utility for SeaORM"
license = "MIT OR Apache-2.0"
homepage = "https://www.sea-ql.org/SeaORM"
documentation = "https://docs.rs/sea-orm"
repository = "https://github.com/SeaQL/sea-orm"
categories = [ "database" ]
categories = ["database"]
keywords = ["async", "orm", "mysql", "postgres", "sqlite"]
default-run = "sea-orm-cli"
rust-version = "1.60"
Expand All @@ -23,20 +23,20 @@ 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 }
async-std = { version = "^1.9", features = ["attributes", "tokio1"], optional = true }
sea-orm-codegen = { version = "^0.10.0", path = "../sea-orm-codegen", optional = true }
sea-schema = { version = "^0.10.2", git = "https://github.com/SeaQL/sea-schema" }
sqlx = { version = "^0.6", default-features = false, features = [ "mysql", "postgres" ], optional = true }
sqlx = { version = "^0.6", default-features = false, features = ["mysql", "postgres"], optional = true }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing = { version = "0.1" }
url = "^2.2"
Expand All @@ -47,11 +47,12 @@ regex = "1"
smol = "1.2.5"

[features]
default = [ "codegen", "runtime-async-std-native-tls", "dotenvy", "async-std" ]
codegen = [ "sea-schema/sqlx-all", "sea-orm-codegen" ]
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" ]
runtime-actix-rustls = [ "sqlx/runtime-actix-rustls", "sea-schema/runtime-actix-rustls" ]
runtime-async-std-rustls = [ "sqlx/runtime-async-std-rustls", "sea-schema/runtime-async-std-rustls" ]
runtime-tokio-rustls = [ "sqlx/runtime-tokio-rustls", "sea-schema/runtime-tokio-rustls" ]
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"]
runtime-actix-rustls = ["sqlx/runtime-actix-rustls", "sea-schema/runtime-actix-rustls"]
runtime-async-std-rustls = ["sqlx/runtime-async-std-rustls", "sea-schema/runtime-async-std-rustls"]
runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls", "sea-schema/runtime-tokio-rustls"]
2 changes: 2 additions & 0 deletions sea-orm-cli/src/commands/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions sea-orm-cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#[cfg(feature = "cli")]
pub mod cli;
pub mod commands;

#[cfg(feature = "cli")]
pub use cli::*;
pub use commands::*;
24 changes: 13 additions & 11 deletions sea-orm-migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
[package]
name = "sea-orm-migration"
version = "0.10.0"
authors = [ "Billy Chan <ccw.billy.123@gmail.com>" ]
authors = ["Billy Chan <ccw.billy.123@gmail.com>"]
edition = "2021"
description = "Migration utility for SeaORM"
license = "MIT OR Apache-2.0"
homepage = "https://www.sea-ql.org/SeaORM"
documentation = "https://docs.rs/sea-orm"
repository = "https://github.com/SeaQL/sea-orm"
categories = [ "database" ]
categories = ["database"]
keywords = ["async", "orm", "mysql", "postgres", "sqlite"]
rust-version = "1.60"

Expand All @@ -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"] }
Expand All @@ -33,12 +33,14 @@ 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"]
runtime-actix-native-tls = [ "sea-orm/runtime-actix-native-tls" ]
runtime-async-std-native-tls = [ "sea-orm/runtime-async-std-native-tls" ]
runtime-tokio-native-tls = [ "sea-orm/runtime-tokio-native-tls" ]
runtime-actix-rustls = [ "sea-orm/runtime-actix-rustls" ]
runtime-async-std-rustls = [ "sea-orm/runtime-async-std-rustls" ]
runtime-tokio-rustls = [ "sea-orm/runtime-tokio-rustls" ]
runtime-actix-native-tls = ["sea-orm/runtime-actix-native-tls"]
runtime-async-std-native-tls = ["sea-orm/runtime-async-std-native-tls"]
runtime-tokio-native-tls = ["sea-orm/runtime-tokio-native-tls"]
runtime-actix-rustls = ["sea-orm/runtime-actix-rustls"]
runtime-async-std-rustls = ["sea-orm/runtime-async-std-rustls"]
runtime-tokio-rustls = ["sea-orm/runtime-tokio-rustls"]
1 change: 1 addition & 0 deletions sea-orm-migration/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(feature = "cli")]
pub mod cli;
pub mod manager;
pub mod migrator;
Expand Down
2 changes: 2 additions & 0 deletions sea-orm-migration/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down

0 comments on commit 9f2eb3d

Please sign in to comment.