From 768e9e7a532c5aff4a199221aff8a6c6c8a0cd15 Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 17 Nov 2025 18:13:50 -0600 Subject: [PATCH 1/4] Allow disabling Config for postgres and tokio-postgres --- refinery/Cargo.toml | 5 ++++- refinery/src/lib.rs | 1 + refinery_core/Cargo.toml | 17 +++++++++++------ refinery_core/src/drivers/mod.rs | 5 +++-- refinery_core/src/lib.rs | 5 +++-- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index f55f0c60..079bdf13 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -13,11 +13,14 @@ edition = "2018" [features] default = ["toml"] +config = ["refinery-core/config"] rusqlite-bundled = ["refinery-core/rusqlite-bundled"] rusqlite = ["refinery-core/rusqlite"] postgres = ["refinery-core/postgres"] +postgres-no-tls = ["refinery-core/postgres-no-tls"] mysql = ["refinery-core/mysql"] tokio-postgres = ["refinery-core/tokio-postgres"] +tokio-postgres-no-tls = ["refinery-core/tokio-postgres-no-tls"] mysql_async = ["refinery-core/mysql_async"] tiberius = ["refinery-core/tiberius"] tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config"] @@ -27,7 +30,7 @@ enums = ["refinery-macros/enums"] int8-versions = ["refinery-core/int8-versions", "refinery-macros/int8-versions"] [dependencies] -refinery-core = { version = "0.9.0", path = "../refinery_core" } +refinery-core = { version = "0.9.0", path = "../refinery_core", default-features = false } refinery-macros = { version = "0.9.0", path = "../refinery_macros" } [dev-dependencies] diff --git a/refinery/src/lib.rs b/refinery/src/lib.rs index 945303cc..569e612a 100644 --- a/refinery/src/lib.rs +++ b/refinery/src/lib.rs @@ -31,6 +31,7 @@ embedded::migrations::runner().run(&mut conn).unwrap(); for more examples refer to the [examples](https://github.com/rust-db/refinery/tree/master/examples) */ +#[cfg(feature = "config")] pub use refinery_core::config; pub use refinery_core::{ error, load_sql_migrations, Error, Migration, Report, Runner, SchemaVersion, Target, diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 3fbd0fe4..d6e92e7c 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -10,13 +10,18 @@ edition = "2021" [features] default = [] -mysql_async = ["dep:mysql_async"] -postgres = ["dep:postgres", "dep:postgres-native-tls", "dep:native-tls"] -rusqlite-bundled = ["rusqlite", "rusqlite/bundled"] +config = [] +mysql_async = ["dep:mysql_async", "config"] +postgres = ["postgres-no-tls", "postgres-tls", "config"] +postgres-no-tls = ["dep:postgres"] +postgres-tls = ["dep:postgres-native-tls", "tls"] +rusqlite-bundled = ["rusqlite", "rusqlite/bundled", "config"] serde = ["dep:serde", "time/serde"] -tiberius = ["dep:tiberius", "futures", "tokio", "tokio/net"] -tiberius-config = ["tiberius", "tokio", "tokio-util", "serde"] -tokio-postgres = ["dep:postgres-native-tls", "dep:native-tls", "dep:tokio-postgres", "tokio", "tokio/rt"] +tiberius = ["dep:tiberius", "dep:futures", "dep:tokio", "tokio/net"] +tiberius-config = ["tiberius", "dep:tokio-util", "dep:serde", "config"] +tls = ["dep:native-tls"] +tokio-postgres = ["tokio-postgres-no-tls", "postgres-tls", "config"] +tokio-postgres-no-tls = ["dep:tokio-postgres", "dep:tokio", "tokio/rt"] toml = ["serde", "dep:toml"] int8-versions = [] diff --git a/refinery_core/src/drivers/mod.rs b/refinery_core/src/drivers/mod.rs index 867d4c4d..c1240cee 100644 --- a/refinery_core/src/drivers/mod.rs +++ b/refinery_core/src/drivers/mod.rs @@ -1,13 +1,13 @@ #[cfg(feature = "rusqlite")] pub mod rusqlite; -#[cfg(feature = "tokio-postgres")] +#[cfg(feature = "tokio-postgres-no-tls")] pub mod tokio_postgres; #[cfg(feature = "mysql_async")] pub mod mysql_async; -#[cfg(feature = "postgres")] +#[cfg(feature = "postgres-no-tls")] pub mod postgres; #[cfg(feature = "mysql")] @@ -16,4 +16,5 @@ pub mod mysql; #[cfg(feature = "tiberius")] pub mod tiberius; +#[cfg(feature = "config")] mod config; diff --git a/refinery_core/src/lib.rs b/refinery_core/src/lib.rs index 2d20865a..0dce2076 100644 --- a/refinery_core/src/lib.rs +++ b/refinery_core/src/lib.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "config")] pub mod config; mod drivers; pub mod error; @@ -16,13 +17,13 @@ pub use crate::util::{ #[cfg(feature = "rusqlite")] pub use rusqlite; -#[cfg(feature = "postgres")] +#[cfg(feature = "postgres-no-tls")] pub use postgres; #[cfg(feature = "mysql")] pub use mysql; -#[cfg(feature = "tokio-postgres")] +#[cfg(feature = "tokio-postgres-no-tls")] pub use tokio_postgres; #[cfg(feature = "mysql_async")] From 83d6482ca0ac7639c8aafb545d6be30c42eb82ee Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 17 Nov 2025 18:23:50 -0600 Subject: [PATCH 2/4] Fix building refinery_cli with no deault features --- refinery_cli/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index e51ac49f..354d85f0 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -24,7 +24,7 @@ mssql = ["refinery-core/tiberius-config", "tokio"] int8-versions = ["refinery-core/int8-versions"] [dependencies] -refinery-core = { version = "0.9.0", path = "../refinery_core", default-features = false, features = ["toml"] } +refinery-core = { version = "0.9.0", path = "../refinery_core", default-features = false, features = ["toml", "config"] } clap = { version = "4", features = ["derive"] } human-panic = "2" toml = "0.8" From 46153b776023950c18375a1cde925101eab34801 Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 17 Nov 2025 19:16:10 -0600 Subject: [PATCH 3/4] Enable config for refinery features --- refinery/Cargo.toml | 14 +++++++------- refinery_core/Cargo.toml | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 079bdf13..4a16fbe4 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -14,15 +14,15 @@ edition = "2018" [features] default = ["toml"] config = ["refinery-core/config"] -rusqlite-bundled = ["refinery-core/rusqlite-bundled"] -rusqlite = ["refinery-core/rusqlite"] -postgres = ["refinery-core/postgres"] +rusqlite-bundled = ["refinery-core/rusqlite-bundled", "config"] +rusqlite = ["refinery-core/rusqlite", "config"] +postgres = ["refinery-core/postgres", "config"] postgres-no-tls = ["refinery-core/postgres-no-tls"] -mysql = ["refinery-core/mysql"] -tokio-postgres = ["refinery-core/tokio-postgres"] +mysql = ["refinery-core/mysql", "config"] +tokio-postgres = ["refinery-core/tokio-postgres", "config"] tokio-postgres-no-tls = ["refinery-core/tokio-postgres-no-tls"] -mysql_async = ["refinery-core/mysql_async"] -tiberius = ["refinery-core/tiberius"] +mysql_async = ["refinery-core/mysql_async", "config"] +tiberius = ["refinery-core/tiberius", "config"] tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config"] serde = ["refinery-core/serde"] toml = ["refinery-core/toml"] diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index d6e92e7c..7772deee 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -15,6 +15,7 @@ mysql_async = ["dep:mysql_async", "config"] postgres = ["postgres-no-tls", "postgres-tls", "config"] postgres-no-tls = ["dep:postgres"] postgres-tls = ["dep:postgres-native-tls", "tls"] +rusqlite = ["dep:rusqlite", "config"] rusqlite-bundled = ["rusqlite", "rusqlite/bundled", "config"] serde = ["dep:serde", "time/serde"] tiberius = ["dep:tiberius", "dep:futures", "dep:tokio", "tokio/net"] From 43d25a596b589871b610aa20dea01f7bfa044e0d Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 17 Nov 2025 19:20:04 -0600 Subject: [PATCH 4/4] Add config to tiberius-config --- refinery/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 4a16fbe4..890bd414 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -23,7 +23,7 @@ tokio-postgres = ["refinery-core/tokio-postgres", "config"] tokio-postgres-no-tls = ["refinery-core/tokio-postgres-no-tls"] mysql_async = ["refinery-core/mysql_async", "config"] tiberius = ["refinery-core/tiberius", "config"] -tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config"] +tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config", "config"] serde = ["refinery-core/serde"] toml = ["refinery-core/toml"] enums = ["refinery-macros/enums"]