From ce0a0d8594b6f7694de1a622afb63166a381dc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 1 Mar 2024 17:33:05 +0000 Subject: [PATCH 01/64] Address Clippy lints and update CI (#315) * apply clippy lints * update CI to address MSRV --- .github/workflows/cargo-publish.yaml | 2 +- .github/workflows/ci.yml | 78 ++++++++++++++------- refinery/Cargo.toml | 2 +- refinery/tests/mysql.rs | 4 +- refinery/tests/postgres.rs | 4 +- refinery/tests/rusqlite.rs | 10 +-- refinery/tests/tiberius.rs | 6 +- refinery_cli/src/migrate.rs | 1 + refinery_cli/tests/cli.rs | 4 +- refinery_core/src/config.rs | 11 ++- refinery_core/src/drivers/config.rs | 3 + refinery_core/src/drivers/tokio_postgres.rs | 2 +- refinery_core/src/error.rs | 9 ++- refinery_core/src/util.rs | 8 +-- 14 files changed, 90 insertions(+), 54 deletions(-) diff --git a/.github/workflows/cargo-publish.yaml b/.github/workflows/cargo-publish.yaml index 92947a86..8d19a76e 100644 --- a/.github/workflows/cargo-publish.yaml +++ b/.github/workflows/cargo-publish.yaml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v3 - name: Setup toolchain - - uses: actions-rs/toolchain@v1 + uses: actions-rs/toolchain@v1 with: toolchain: stable diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad75d79f..3c26e509 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,8 @@ jobs: name: CI is green runs-on: ubuntu-latest needs: - - cargo-fmt-clippy-and-test-macros-and-cli + - cargo-fmt-clippy + - test-macros-and-cli - test-sqlite - test-postgres - test-tokio-postgres @@ -17,35 +18,59 @@ jobs: steps: - run: exit 0 - cargo-fmt-clippy-and-test-macros-and-cli: - name: Cargo fmt/clippy/test-macros-and-cli - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, ubuntu-latest] - rust: [stable, nightly, 1.56.0] + set-rust-versions: + runs-on: ubuntu-latest + outputs: + versions: ${{ steps.set-versions.outputs.versions }} + steps: + - name: checkout repo + uses: actions/checkout@v2 + - id: set-versions + run: | + MSRV=$(grep -oP 'rust-version\s*=\s*"\K[^"]+' ./refinery/Cargo.toml) + echo "versions=['stable', 'nightly', '$MSRV']" >> $GITHUB_OUTPUT + + cargo-fmt-clippy: + name: Cargo fmt and clippy + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: - toolchain: ${{ matrix.rust }} + toolchain: beta - run: rustup self update - run: rustup component add clippy - run: rustup component add rustfmt - run: cargo fmt --all -- --check + - run: cargo clippy --all-targets --all-features + + test-macros-and-cli: + name: test-macros-and-cli + needs: set-rust-versions + strategy: + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} + os: [windows-latest, ubuntu-latest] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + - run: rustup self update - run: cd refinery_core && cargo test --all-features -- --test-threads 1 - run: cd refinery && cargo build --all-features - - run: cd refinery_macros && cargo clippy - - run: cd refinery_cli && cargo clippy - run: cd refinery_macros && cargo test - run: cd refinery_cli && cargo test test-sqlite: name: Test Sqlite + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: - rust: [stable, nightly, 1.65.0] + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -56,10 +81,11 @@ jobs: test-postgres: name: Test postgres + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: - rust: [stable, nightly, 1.56.0] + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} services: postgres: image: postgres:9.6.13-alpine @@ -75,10 +101,11 @@ jobs: test-tokio-postgres: name: Test tokio-postgres - runs-on: ubuntu-latest + needs: set-rust-versions strategy: - matrix: - rust: [stable, nightly, 1.56.0] + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} + runs-on: ubuntu-latest services: postgres: image: postgres:9.6.13-alpine @@ -93,10 +120,11 @@ jobs: test-mysql: name: Test mysql + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: - rust: [stable, nightly, 1.56.0] + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} services: postgres: image: mysql:latest @@ -117,10 +145,11 @@ jobs: test-mysql-async: name: Test mysql-async + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: - rust: [stable, nightly, 1.56.0] + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} services: postgres: image: mysql:latest @@ -140,10 +169,11 @@ jobs: test-tiberius: name: Test tiberius + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: - rust: [stable, nightly, 1.56.0] + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} services: mssql: image: mcr.microsoft.com/mssql/server:2017-latest diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 0a054d4c..9b1bd901 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "refinery" version = "0.8.12" -rust-version = "1.56" +rust-version = "1.75" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" description = "Powerful SQL migration toolkit for Rust" diff --git a/refinery/tests/mysql.rs b/refinery/tests/mysql.rs index 0bfdf971..a9c487bd 100644 --- a/refinery/tests/mysql.rs +++ b/refinery/tests/mysql.rs @@ -78,7 +78,7 @@ mod mysql { where T: FnOnce() + std::panic::UnwindSafe, { - let result = std::panic::catch_unwind(|| test()); + let result = std::panic::catch_unwind(test); clean_database(); @@ -767,7 +767,7 @@ mod mysql { // cli only finds .sql migration files run_test(|| { Command::new("refinery") - .args(&[ + .args([ "migrate", "-c", "tests/mysql_refinery.toml", diff --git a/refinery/tests/postgres.rs b/refinery/tests/postgres.rs index 39321ed8..2ee4e756 100644 --- a/refinery/tests/postgres.rs +++ b/refinery/tests/postgres.rs @@ -82,7 +82,7 @@ mod postgres { where T: FnOnce() + std::panic::UnwindSafe, { - let result = std::panic::catch_unwind(|| test()); + let result = std::panic::catch_unwind(test); clean_database(); @@ -748,7 +748,7 @@ mod postgres { fn migrates_from_cli() { run_test(|| { Command::new("refinery") - .args(&[ + .args([ "migrate", "-c", "tests/postgres_refinery.toml", diff --git a/refinery/tests/rusqlite.rs b/refinery/tests/rusqlite.rs index 27e818c3..258af424 100644 --- a/refinery/tests/rusqlite.rs +++ b/refinery/tests/rusqlite.rs @@ -40,7 +40,7 @@ mod rusqlite { let filepath = "tests/db.sql"; File::create(filepath).unwrap(); - let result = std::panic::catch_unwind(|| test()); + let result = std::panic::catch_unwind(test); fs::remove_file(filepath).unwrap(); @@ -199,7 +199,7 @@ mod rusqlite { conn.execute( "INSERT INTO persons (name, city) VALUES (?, ?)", - &["John Legend", "New York"], + ["John Legend", "New York"], ) .unwrap(); let (name, city): (String, String) = conn @@ -222,7 +222,7 @@ mod rusqlite { conn.execute( "INSERT INTO persons (name, city) VALUES (?, ?)", - &["John Legend", "New York"], + ["John Legend", "New York"], ) .unwrap(); let (name, city): (String, String) = conn @@ -245,7 +245,7 @@ mod rusqlite { conn.execute( "INSERT INTO persons (name, city) VALUES (?, ?)", - &["John Legend", "New York"], + ["John Legend", "New York"], ) .unwrap(); let (name, city): (String, String) = conn @@ -831,7 +831,7 @@ mod rusqlite { fn migrates_from_cli() { run_test(|| { Command::new("refinery") - .args(&[ + .args([ "migrate", "-c", "tests/sqlite_refinery.toml", diff --git a/refinery/tests/tiberius.rs b/refinery/tests/tiberius.rs index f9011404..f6346063 100644 --- a/refinery/tests/tiberius.rs +++ b/refinery/tests/tiberius.rs @@ -1,6 +1,6 @@ use barrel::backend::MsSql as Sql; -#[cfg(all(feature = "tiberius-config"))] +#[cfg(feature = "tiberius-config")] mod tiberius { use assert_cmd::prelude::*; use futures::FutureExt; @@ -16,7 +16,7 @@ mod tiberius { use time::OffsetDateTime; use tokio_util::compat::TokioAsyncWriteCompatExt; - const CONFIG: &'static str = "mssql://SA:Passw0rd@localhost:1433/refinery_test?trust_cert=true"; + const CONFIG: &str = "mssql://SA:Passw0rd@localhost:1433/refinery_test?trust_cert=true"; const DEFAULT_TABLE_NAME: &str = "refinery_schema_history"; fn get_migrations() -> Vec { @@ -1076,7 +1076,7 @@ mod tiberius { async fn migrates_from_cli() { run_test(async { Command::new("refinery") - .args(&[ + .args([ "migrate", "-c", "tests/tiberius_refinery.toml", diff --git a/refinery_cli/src/migrate.rs b/refinery_cli/src/migrate.rs index f35c5d64..b61fa876 100644 --- a/refinery_cli/src/migrate.rs +++ b/refinery_cli/src/migrate.rs @@ -23,6 +23,7 @@ pub fn handle_migration_command(args: MigrateArgs) -> anyhow::Result<()> { Ok(()) } +#[allow(clippy::too_many_arguments)] fn run_migrations( config_location: &Path, grouped: bool, diff --git a/refinery_cli/tests/cli.rs b/refinery_cli/tests/cli.rs index 2ddd3e7b..863f0787 100644 --- a/refinery_cli/tests/cli.rs +++ b/refinery_cli/tests/cli.rs @@ -13,7 +13,7 @@ mod cli { fn cli_version() { Command::cargo_bin("refinery") .unwrap() - .args(&["-V"]) + .args(["-V"]) .assert() .stdout(contains(env!("CARGO_PKG_VERSION"))); } @@ -23,7 +23,7 @@ mod cli { fn migrate_no_args() { Command::cargo_bin("refinery") .unwrap() - .args(&["migrate"]) + .args(["migrate"]) .assert() .failure(); } diff --git a/refinery_core/src/config.rs b/refinery_core/src/config.rs index 2f3b1e63..7eba833f 100644 --- a/refinery_core/src/config.rs +++ b/refinery_core/src/config.rs @@ -1,8 +1,7 @@ use crate::error::Kind; use crate::Error; use std::convert::TryFrom; -use std::fs; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use std::str::FromStr; use url::Url; @@ -54,7 +53,7 @@ impl Config { /// create a new Config instance from a config file located on the file system #[cfg(feature = "toml")] - pub fn from_file_location>(location: T) -> Result { + pub fn from_file_location>(location: T) -> Result { let file = std::fs::read_to_string(&location).map_err(|err| { Error::new( Kind::ConfigError(format!("could not open config file, {}", err)), @@ -86,7 +85,7 @@ impl Config { .unwrap_or(&std::env::current_dir().unwrap()) .to_path_buf(); - config_db_dir = fs::canonicalize(config_db_dir).unwrap(); + config_db_dir = std::fs::canonicalize(config_db_dir).unwrap(); config_db_path = config_db_dir.join(&config_db_path) } @@ -105,7 +104,7 @@ impl Config { cfg_if::cfg_if! { if #[cfg(feature = "rusqlite")] { - pub(crate) fn db_path(&self) -> Option<&Path> { + pub(crate) fn db_path(&self) -> Option<&std::path::Path> { self.main.db_path.as_deref() } @@ -338,7 +337,7 @@ cfg_if::cfg_if! { if config.main.trust_cert { tconfig.trust_cert(); } - tconfig.authentication(AuthMethod::sql_server(&user, &pass)); + tconfig.authentication(AuthMethod::sql_server(user, pass)); Ok(tconfig) } diff --git a/refinery_core/src/drivers/config.rs b/refinery_core/src/drivers/config.rs index 92a00582..639ff108 100644 --- a/refinery_core/src/drivers/config.rs +++ b/refinery_core/src/drivers/config.rs @@ -49,8 +49,10 @@ impl AsyncQuery> for Config { } // this is written as macro so that we don't have to deal with type signatures #[cfg(any(feature = "mysql", feature = "postgres", feature = "rusqlite"))] +#[allow(clippy::redundant_closure_call)] macro_rules! with_connection { ($config:ident, $op: expr) => { + #[allow(clippy::redundant_closure_call)] match $config.db_type() { ConfigDbType::Mysql => { cfg_if::cfg_if! { @@ -101,6 +103,7 @@ macro_rules! with_connection { ))] macro_rules! with_connection_async { ($config: ident, $op: expr) => { + #[allow(clippy::redundant_closure_call)] match $config.db_type() { ConfigDbType::Mysql => { cfg_if::cfg_if! { diff --git a/refinery_core/src/drivers/tokio_postgres.rs b/refinery_core/src/drivers/tokio_postgres.rs index e8feaf7a..ec8bb9c8 100644 --- a/refinery_core/src/drivers/tokio_postgres.rs +++ b/refinery_core/src/drivers/tokio_postgres.rs @@ -39,7 +39,7 @@ impl AsyncTransaction for Client { let transaction = self.transaction().await?; let mut count = 0; for query in queries { - transaction.batch_execute(*query).await?; + transaction.batch_execute(query).await?; count += 1; } transaction.commit().await?; diff --git a/refinery_core/src/error.rs b/refinery_core/src/error.rs index 3e865c1e..38051ce8 100644 --- a/refinery_core/src/error.rs +++ b/refinery_core/src/error.rs @@ -6,14 +6,17 @@ use thiserror::Error as TError; /// An Error occurred during a migration cycle #[derive(Debug)] pub struct Error { - kind: Kind, + kind: Box, report: Option, } impl Error { /// Instantiate a new Error pub(crate) fn new(kind: Kind, report: Option) -> Error { - Error { kind, report } + Error { + kind: Box::new(kind), + report, + } } /// Return the Report of the migration cycle if any @@ -85,7 +88,7 @@ where match self { Ok(report) => Ok(report), Err(err) => Err(Error { - kind: Kind::Connection(msg.into(), Box::new(err)), + kind: Box::new(Kind::Connection(msg.into(), Box::new(err))), report: applied_migrations.map(|am| Report::new(am.to_vec())), }), } diff --git a/refinery_core/src/util.rs b/refinery_core/src/util.rs index 5992aab3..60b32661 100644 --- a/refinery_core/src/util.rs +++ b/refinery_core/src/util.rs @@ -89,9 +89,9 @@ mod tests { let migrations_dir = tmp_dir.path().join("migrations"); fs::create_dir(&migrations_dir).unwrap(); let sql1 = migrations_dir.join("V1first.rs"); - fs::File::create(&sql1).unwrap(); + fs::File::create(sql1).unwrap(); let sql2 = migrations_dir.join("V2second.rs"); - fs::File::create(&sql2).unwrap(); + fs::File::create(sql2).unwrap(); let mut mods = find_migration_files(migrations_dir, MigrationType::All).unwrap(); assert!(mods.next().is_none()); @@ -139,9 +139,9 @@ mod tests { let migrations_dir = tmp_dir.path().join("migrations"); fs::create_dir(&migrations_dir).unwrap(); let sql1 = migrations_dir.join("V1first.sql"); - fs::File::create(&sql1).unwrap(); + fs::File::create(sql1).unwrap(); let sql2 = migrations_dir.join("V2second.sql"); - fs::File::create(&sql2).unwrap(); + fs::File::create(sql2).unwrap(); let mut mods = find_migration_files(migrations_dir, MigrationType::All).unwrap(); assert!(mods.next().is_none()); From e49eb1f851025f7ec266d6660b57b336ed74fc9a Mon Sep 17 00:00:00 2001 From: Kolya Kornilov Date: Sun, 3 Mar 2024 00:12:43 +0300 Subject: [PATCH 02/64] Bump rusqlite version (#317) --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 0bd2ea05..63adaa6e 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -29,7 +29,7 @@ url = "2.0" walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar -rusqlite = { version = ">= 0.23, <= 0.30", optional = true } +rusqlite = { version = ">= 0.23, <= 0.31", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 24", optional = true, default-features = false, features = ["minimal"] } From 83c8cbac78f562e7012cd53f94fbe5af1263a8ef Mon Sep 17 00:00:00 2001 From: Alfred Hodler Date: Sun, 3 Mar 2024 19:35:24 +0000 Subject: [PATCH 03/64] Dynamic migration dicovery, bug fix (#313) * Fixes a bug in `get_last_applied_migration` due to an incorrect SQL query that partially uses dynamic table names and partially hardcodes the default one. * Adds a new utility function that enables dynamic migration discovery where embedding is not desirable. --- refinery/src/lib.rs | 2 +- refinery_core/src/error.rs | 3 ++ refinery_core/src/lib.rs | 2 +- refinery_core/src/traits/mod.rs | 2 +- refinery_core/src/util.rs | 53 ++++++++++++++++++++++++++++++++- 5 files changed, 58 insertions(+), 4 deletions(-) diff --git a/refinery/src/lib.rs b/refinery/src/lib.rs index a3a4d780..93cfaac5 100644 --- a/refinery/src/lib.rs +++ b/refinery/src/lib.rs @@ -32,7 +32,7 @@ for more examples refer to the [examples](https://github.com/rust-db/refinery/tr */ pub use refinery_core::config; -pub use refinery_core::{error, Error, Migration, Report, Runner, Target}; +pub use refinery_core::{error, load_sql_migrations, Error, Migration, Report, Runner, Target}; #[doc(hidden)] pub use refinery_core::{AsyncMigrate, Migrate}; pub use refinery_macros::embed_migrations; diff --git a/refinery_core/src/error.rs b/refinery_core/src/error.rs index 38051ce8..2b1b4661 100644 --- a/refinery_core/src/error.rs +++ b/refinery_core/src/error.rs @@ -69,6 +69,9 @@ pub enum Kind { /// An Error from an underlying database connection Error #[error("`{0}`, `{1}`")] Connection(String, #[source] Box), + /// An Error from an invalid migration file (not UTF-8 etc) + #[error("invalid migration file at path {0}, {1}")] + InvalidMigrationFile(PathBuf, std::io::Error), } // Helper trait for adding custom messages and applied migrations to Connection error's. diff --git a/refinery_core/src/lib.rs b/refinery_core/src/lib.rs index 35d02a47..cdd426de 100644 --- a/refinery_core/src/lib.rs +++ b/refinery_core/src/lib.rs @@ -9,7 +9,7 @@ pub use crate::error::Error; pub use crate::runner::{Migration, Report, Runner, Target}; pub use crate::traits::r#async::AsyncMigrate; pub use crate::traits::sync::Migrate; -pub use crate::util::{find_migration_files, MigrationType}; +pub use crate::util::{find_migration_files, load_sql_migrations, MigrationType}; #[cfg(feature = "rusqlite")] pub use rusqlite; diff --git a/refinery_core/src/traits/mod.rs b/refinery_core/src/traits/mod.rs index 9d79a5d1..d3eef6d3 100644 --- a/refinery_core/src/traits/mod.rs +++ b/refinery_core/src/traits/mod.rs @@ -115,7 +115,7 @@ pub(crate) const GET_APPLIED_MIGRATIONS_QUERY: &str = "SELECT version, name, app pub(crate) const GET_LAST_APPLIED_MIGRATION_QUERY: &str = "SELECT version, name, applied_on, checksum - FROM %MIGRATION_TABLE_NAME% WHERE version=(SELECT MAX(version) from refinery_schema_history)"; + FROM %MIGRATION_TABLE_NAME% WHERE version=(SELECT MAX(version) from %MIGRATION_TABLE_NAME%)"; pub(crate) const DEFAULT_MIGRATION_TABLE_NAME: &str = "refinery_schema_history"; diff --git a/refinery_core/src/util.rs b/refinery_core/src/util.rs index 60b32661..2fdce3f7 100644 --- a/refinery_core/src/util.rs +++ b/refinery_core/src/util.rs @@ -1,4 +1,5 @@ use crate::error::{Error, Kind}; +use crate::Migration; use regex::Regex; use std::ffi::OsStr; use std::path::{Path, PathBuf}; @@ -58,9 +59,41 @@ pub fn find_migration_files( Ok(file_paths) } +/// Loads SQL migrations from a path. This enables dynamic migration discovery, as opposed to +/// embedding. The resulting collection is ordered by version. +pub fn load_sql_migrations(location: impl AsRef) -> Result, Error> { + let migration_files = find_migration_files(location, MigrationType::Sql)?; + + let mut migrations = vec![]; + + for path in migration_files { + let sql = std::fs::read_to_string(path.as_path()).map_err(|e| { + let path = path.to_owned(); + let kind = match e.kind() { + std::io::ErrorKind::NotFound => Kind::InvalidMigrationPath(path, e), + _ => Kind::InvalidMigrationFile(path, e), + }; + + Error::new(kind, None) + })?; + + //safe to call unwrap as find_migration_filenames returns canonical paths + let filename = path + .file_stem() + .and_then(|file| file.to_os_string().into_string().ok()) + .unwrap(); + + let migration = Migration::unapplied(&filename, &sql)?; + migrations.push(migration); + } + + migrations.sort(); + Ok(migrations) +} + #[cfg(test)] mod tests { - use super::{find_migration_files, MigrationType}; + use super::{find_migration_files, load_sql_migrations, MigrationType}; use std::fs; use std::path::PathBuf; use tempfile::TempDir; @@ -146,4 +179,22 @@ mod tests { let mut mods = find_migration_files(migrations_dir, MigrationType::All).unwrap(); assert!(mods.next().is_none()); } + + #[test] + fn loads_migrations_from_path() { + let tmp_dir = TempDir::new().unwrap(); + let migrations_dir = tmp_dir.path().join("migrations"); + fs::create_dir(&migrations_dir).unwrap(); + let sql1 = migrations_dir.join("V1__first.sql"); + fs::File::create(&sql1).unwrap(); + let sql2 = migrations_dir.join("V2__second.sql"); + fs::File::create(&sql2).unwrap(); + let rs3 = migrations_dir.join("V3__third.rs"); + fs::File::create(&rs3).unwrap(); + + let migrations = load_sql_migrations(migrations_dir).unwrap(); + assert_eq!(migrations.len(), 2); + assert_eq!(&migrations[0].to_string(), "V1__first"); + assert_eq!(&migrations[1].to_string(), "V2__second"); + } } From 7e922af38cd1573cf23f695d1a3293badb47c300 Mon Sep 17 00:00:00 2001 From: Hildeberto Mendonca <200272+htmfilho@users.noreply.github.com> Date: Tue, 5 Mar 2024 12:03:15 -0500 Subject: [PATCH 04/64] Make the relative link to examples work from the refinery folder (#318) Make the relative link to example work from the refinery folder --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f91bbfd..bac63cdd 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,7 @@ fn main() { } ``` -For more library examples, refer to the [`examples`](examples). - +For more library examples, refer to the [`examples`](https://github.com/rust-db/refinery/tree/main/examples). ### Example: CLI NOTE: From 1e2411cb274ddc4f784c56d7e12fe820af712d6d Mon Sep 17 00:00:00 2001 From: Andrey Nikolaev <131762131+gvozdvmozgu@users.noreply.github.com> Date: Mon, 11 Mar 2024 14:04:14 +0300 Subject: [PATCH 05/64] fix newline handling for Windows in database configuration setup (#320) --- refinery_cli/src/setup.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/refinery_cli/src/setup.rs b/refinery_cli/src/setup.rs index aa9783bd..e6e06f90 100644 --- a/refinery_cli/src/setup.rs +++ b/refinery_cli/src/setup.rs @@ -35,7 +35,7 @@ fn get_config_from_input() -> Result { let mut db_type = String::new(); io::stdin().read_line(&mut db_type)?; - let db_type = match db_type.as_str().trim() { + let db_type = match db_type.trim() { "1" => ConfigDbType::Mysql, "2" => ConfigDbType::Postgres, "3" => ConfigDbType::Sqlite, @@ -51,8 +51,6 @@ fn get_config_from_input() -> Result { io::stdout().flush()?; let mut db_path = String::new(); io::stdin().read_line(&mut db_path)?; - //remove \n - db_path.pop(); config = config.set_db_path(db_path.trim()); return Ok(config); } else { @@ -65,36 +63,31 @@ fn get_config_from_input() -> Result { io::stdout().flush()?; let mut db_host = String::new(); io::stdin().read_line(&mut db_host)?; - db_host.pop(); - config = config.set_db_host(&db_host); + config = config.set_db_host(db_host.trim()); print!("Enter database port: "); io::stdout().flush()?; let mut db_port = String::new(); io::stdin().read_line(&mut db_port)?; - db_port.pop(); - config = config.set_db_port(&db_port); + config = config.set_db_port(db_port.trim()); print!("Enter database username: "); io::stdout().flush()?; let mut db_user = String::new(); io::stdin().read_line(&mut db_user)?; - db_user.pop(); - config = config.set_db_user(&db_user); + config = config.set_db_user(db_user.trim()); print!("Enter database password: "); io::stdout().flush()?; let mut db_pass = String::new(); io::stdin().read_line(&mut db_pass)?; - db_pass.pop(); - config = config.set_db_pass(&db_pass); + config = config.set_db_pass(db_pass.trim()); print!("Enter database name: "); io::stdout().flush()?; let mut db_name = String::new(); io::stdin().read_line(&mut db_name)?; - db_name.pop(); - config = config.set_db_name(&db_name); + config = config.set_db_name(db_name.trim()); Ok(config) } From 9672719428b0255197b1dff81588aa6011e03635 Mon Sep 17 00:00:00 2001 From: Will Eaton Date: Wed, 27 Mar 2024 14:00:15 -0400 Subject: [PATCH 06/64] make public (#321) --- refinery_core/src/runner.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refinery_core/src/runner.rs b/refinery_core/src/runner.rs index 87cd00df..2e6d2143 100644 --- a/refinery_core/src/runner.rs +++ b/refinery_core/src/runner.rs @@ -125,7 +125,7 @@ impl Migration { } // Create a migration from an applied migration on the database - pub(crate) fn applied( + pub fn applied( version: i32, name: String, applied_on: OffsetDateTime, @@ -144,7 +144,7 @@ impl Migration { } // convert the Unapplied into an Applied Migration - pub(crate) fn set_applied(&mut self) { + pub fn set_applied(&mut self) { self.applied_on = Some(OffsetDateTime::now_utc()); self.state = State::Applied; } From 135acc8e14d316fd28803aa55a3a3b27c8e8072a Mon Sep 17 00:00:00 2001 From: Adrian Black Date: Thu, 28 Mar 2024 07:03:49 -0700 Subject: [PATCH 07/64] Migration enums (#312) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * generate EmbeddedMigrations enum * create enum from migration * consolidate regex and remove lazy_static * fmt, cleanup * remove unused trait * use From for migration enum * remove unneeded usings * add feature flag, update example project * fmt * Update refinery_core/src/util.rs Co-authored-by: João Oliveira * Update refinery_core/src/util.rs Co-authored-by: João Oliveira * Update refinery_core/src/util.rs Co-authored-by: João Oliveira * Update refinery_core/src/util.rs Co-authored-by: João Oliveira --------- Co-authored-by: João Oliveira --- .github/workflows/ci.yml | 2 +- Cargo.toml | 3 +- examples/Cargo.toml | 19 ++++++++++++ examples/main.rs | 18 ----------- examples/src/main.rs | 42 +++++++++++++++++++++++++ refinery/Cargo.toml | 1 + refinery_core/src/lib.rs | 4 ++- refinery_core/src/runner.rs | 25 ++------------- refinery_core/src/util.rs | 54 +++++++++++++++++++++++++++----- refinery_macros/Cargo.toml | 4 +++ refinery_macros/src/lib.rs | 62 +++++++++++++++++++++++++++++++++++++ 11 files changed, 183 insertions(+), 51 deletions(-) create mode 100644 examples/Cargo.toml delete mode 100644 examples/main.rs create mode 100644 examples/src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c26e509..120dda86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: - run: rustup self update - run: cd refinery_core && cargo test --all-features -- --test-threads 1 - run: cd refinery && cargo build --all-features - - run: cd refinery_macros && cargo test + - run: cd refinery_macros && cargo test --features=enums - run: cd refinery_cli && cargo test test-sqlite: diff --git a/Cargo.toml b/Cargo.toml index c23c3fab..687ee474 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,5 +3,6 @@ members = [ "refinery", "refinery_cli", "refinery_core", - "refinery_macros" + "refinery_macros", + "examples" ] diff --git a/examples/Cargo.toml b/examples/Cargo.toml new file mode 100644 index 00000000..4914afeb --- /dev/null +++ b/examples/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "refinery-examples" +version = "0.8.12" +authors = ["Katharina Fey ", "João Oliveira "] +description = "Minimal Refinery usage example" +license = "MIT OR Apache-2.0" +documentation = "https://docs.rs/refinery/" +repository = "https://github.com/rust-db/refinery" +edition = "2021" + +[features] +enums = ["refinery/enums"] + +[dependencies] +refinery = { path = "../refinery", features = ["rusqlite"] } +rusqlite = "0.29" +barrel = { version = "0.7", features = ["sqlite3"] } +log = "0.4" +env_logger = "0.11" \ No newline at end of file diff --git a/examples/main.rs b/examples/main.rs deleted file mode 100644 index 6d4948bd..00000000 --- a/examples/main.rs +++ /dev/null @@ -1,18 +0,0 @@ -use rusqlite::Connection; - -mod embedded { - use refinery::embed_migrations; - embed_migrations!("refinery/examples/embedded/migrations"); -} - -fn main() { - let mut conn = Connection::open_in_memory().unwrap(); - - // run all migrations in one go - embedded::migrations::runner().run(&mut conn).unwrap(); - - // or create an iterator over migrations as they run - for migration in embedded::migrations::runner().run_iter(&mut conn) { - info!("Got a migration: {}", migration.expect("migration failed!")); - } -} diff --git a/examples/src/main.rs b/examples/src/main.rs new file mode 100644 index 00000000..88772344 --- /dev/null +++ b/examples/src/main.rs @@ -0,0 +1,42 @@ +use barrel::backend::Sqlite as Sql; +use log::info; +use refinery::Migration; +use rusqlite::Connection; + +refinery::embed_migrations!("migrations"); + +fn main() { + env_logger::init(); + + let mut conn = Connection::open_in_memory().unwrap(); + + let use_iteration = std::env::args().any(|a| a.to_lowercase().eq("--iterate")); + + if use_iteration { + // create an iterator over migrations as they run + for migration in migrations::runner().run_iter(&mut conn) { + process_migration(migration.expect("Migration failed!")); + } + } else { + // or run all migrations in one go + migrations::runner().run(&mut conn).unwrap(); + } +} + +fn process_migration(migration: Migration) { + #[cfg(not(feature = "enums"))] + { + // run something after each migration + info!("Post-processing a migration: {}", migration) + } + + #[cfg(feature = "enums")] + { + // or with the `enums` feature enabled, match against migrations to run specific post-migration steps + use migrations::EmbeddedMigration; + match migration.into() { + EmbeddedMigration::Initial(m) => info!("V{}: Initialized the database!", m.version()), + m => info!("Got a migration: {:?}", m), + } + } +} diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 9b1bd901..c19ce8cf 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -24,6 +24,7 @@ tiberius = ["refinery-core/tiberius"] tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config"] serde = ["refinery-core/serde"] toml = ["refinery-core/toml"] +enums = ["refinery-macros/enums"] [dependencies] refinery-core = { version = "0.8.12", path = "../refinery_core" } diff --git a/refinery_core/src/lib.rs b/refinery_core/src/lib.rs index cdd426de..b4d85b77 100644 --- a/refinery_core/src/lib.rs +++ b/refinery_core/src/lib.rs @@ -9,7 +9,9 @@ pub use crate::error::Error; pub use crate::runner::{Migration, Report, Runner, Target}; pub use crate::traits::r#async::AsyncMigrate; pub use crate::traits::sync::Migrate; -pub use crate::util::{find_migration_files, load_sql_migrations, MigrationType}; +pub use crate::util::{ + find_migration_files, load_sql_migrations, parse_migration_name, MigrationType, +}; #[cfg(feature = "rusqlite")] pub use rusqlite; diff --git a/refinery_core/src/runner.rs b/refinery_core/src/runner.rs index 2e6d2143..46d4d714 100644 --- a/refinery_core/src/runner.rs +++ b/refinery_core/src/runner.rs @@ -1,4 +1,3 @@ -use regex::Regex; use siphasher::sip::SipHasher13; use time::OffsetDateTime; @@ -7,19 +6,12 @@ use std::cmp::Ordering; use std::collections::VecDeque; use std::fmt; use std::hash::{Hash, Hasher}; -use std::sync::OnceLock; -use crate::error::Kind; use crate::traits::{sync::migrate as sync_migrate, DEFAULT_MIGRATION_TABLE_NAME}; +use crate::util::parse_migration_name; use crate::{AsyncMigrate, Error, Migrate}; use std::fmt::Formatter; -// regex used to match file names -pub fn file_match_re() -> &'static Regex { - static RE: OnceLock = OnceLock::new(); - RE.get_or_init(|| Regex::new(r"^([U|V])(\d+(?:\.\d+)?)__(\w+)").unwrap()) -} - /// An enum set that represents the type of the Migration #[derive(Clone, PartialEq)] pub enum Type { @@ -84,20 +76,7 @@ impl Migration { /// Create an unapplied migration, name and version are parsed from the input_name, /// which must be named in the format (U|V){1}__{2}.rs where {1} represents the migration version and {2} the name. pub fn unapplied(input_name: &str, sql: &str) -> Result { - let captures = file_match_re() - .captures(input_name) - .filter(|caps| caps.len() == 4) - .ok_or_else(|| Error::new(Kind::InvalidName, None))?; - let version: i32 = captures[2] - .parse() - .map_err(|_| Error::new(Kind::InvalidVersion, None))?; - - let name: String = (&captures[3]).into(); - let prefix = match &captures[1] { - "V" => Type::Versioned, - "U" => Type::Unversioned, - _ => unreachable!(), - }; + let (prefix, version, name) = parse_migration_name(input_name)?; // Previously, `std::collections::hash_map::DefaultHasher` was used // to calculate the checksum and the implementation at that time diff --git a/refinery_core/src/util.rs b/refinery_core/src/util.rs index 2fdce3f7..24a2c65d 100644 --- a/refinery_core/src/util.rs +++ b/refinery_core/src/util.rs @@ -1,10 +1,32 @@ use crate::error::{Error, Kind}; +use crate::runner::Type; use crate::Migration; use regex::Regex; use std::ffi::OsStr; use std::path::{Path, PathBuf}; +use std::sync::OnceLock; use walkdir::{DirEntry, WalkDir}; +const STEM_RE: &'static str = r"^([U|V])(\d+(?:\.\d+)?)__(\w+)"; + +/// Matches the stem of a migration file. +fn file_stem_re() -> &'static Regex { + static RE: OnceLock = OnceLock::new(); + RE.get_or_init(|| Regex::new(STEM_RE).unwrap()) +} + +/// Matches the stem + extension of a SQL migration file. +fn file_re_sql() -> &'static Regex { + static RE: OnceLock = OnceLock::new(); + RE.get_or_init(|| Regex::new([STEM_RE, r"\.sql$"].concat().as_str()).unwrap()) +} + +/// Matches the stem + extension of any migration file. +fn file_re_all() -> &'static Regex { + static RE: OnceLock = OnceLock::new(); + RE.get_or_init(|| Regex::new([STEM_RE, r"\.(rs|sql)$"].concat().as_str()).unwrap()) +} + /// enum containing the migration types used to search for migrations /// either just .sql files or both .sql and .rs pub enum MigrationType { @@ -13,16 +35,34 @@ pub enum MigrationType { } impl MigrationType { - fn file_match_re(&self) -> Regex { - let ext = match self { - MigrationType::All => "(rs|sql)", - MigrationType::Sql => "sql", - }; - let re_str = format!(r"^(U|V)(\d+(?:\.\d+)?)__(\w+)\.{}$", ext); - Regex::new(re_str.as_str()).unwrap() + fn file_match_re(&self) -> &'static Regex { + match self { + MigrationType::All => file_re_all(), + MigrationType::Sql => file_re_sql(), + } } } +/// Parse a migration filename stem into a prefix, version, and name. +pub fn parse_migration_name(name: &str) -> Result<(Type, i32, String), Error> { + let captures = file_stem_re() + .captures(name) + .filter(|caps| caps.len() == 4) + .ok_or_else(|| Error::new(Kind::InvalidName, None))?; + let version: i32 = captures[2] + .parse() + .map_err(|_| Error::new(Kind::InvalidVersion, None))?; + + let name: String = (&captures[3]).into(); + let prefix = match &captures[1] { + "V" => Type::Versioned, + "U" => Type::Unversioned, + _ => unreachable!(), + }; + + Ok((prefix, version, name)) +} + /// find migrations on file system recursively across directories given a location and [MigrationType] pub fn find_migration_files( location: impl AsRef, diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 647836b8..1ee1a0f1 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -8,6 +8,9 @@ documentation = "https://docs.rs/refinery/" repository = "https://github.com/rust-db/refinery" edition = "2018" +[features] +enums = [] + [lib] proc-macro = true @@ -17,6 +20,7 @@ quote = "1" syn = "2" proc-macro2 = "1" regex = "1" +heck = "0.4" [dev-dependencies] tempfile = "3" diff --git a/refinery_macros/src/lib.rs b/refinery_macros/src/lib.rs index 34586fb7..a185058b 100644 --- a/refinery_macros/src/lib.rs +++ b/refinery_macros/src/lib.rs @@ -1,6 +1,7 @@ //! Contains Refinery macros that are used to import and embed migration files. #![recursion_limit = "128"] +use heck::ToUpperCamelCase; use proc_macro::TokenStream; use proc_macro2::{Span as Span2, TokenStream as TokenStream2}; use quote::quote; @@ -31,6 +32,42 @@ fn migration_fn_quoted(_migrations: Vec) -> TokenStream2 { result } +fn migration_enum_quoted(migration_names: &[impl AsRef]) -> TokenStream2 { + if cfg!(feature = "enums") { + let mut variants = Vec::new(); + let mut discriminants = Vec::new(); + + for m in migration_names { + let m = m.as_ref(); + let (_, version, name) = refinery_core::parse_migration_name(m) + .unwrap_or_else(|e| panic!("Couldn't parse migration filename '{}': {:?}", m, e)); + let variant = Ident::new(name.to_upper_camel_case().as_str(), Span2::call_site()); + variants.push(quote! { #variant(Migration) = #version }); + discriminants.push(quote! { #version => Self::#variant(migration) }); + } + discriminants.push(quote! { v => panic!("Invalid migration version '{}'", v) }); + + let result = quote! { + #[repr(i32)] + #[derive(Debug)] + pub enum EmbeddedMigration { + #(#variants),* + } + + impl From for EmbeddedMigration { + fn from(migration: Migration) -> Self { + match migration.version() as i32 { + #(#discriminants),* + } + } + } + }; + result + } else { + quote!() + } +} + /// Interpret Rust or SQL migrations and inserts a function called runner that when called returns a [`Runner`] instance with the collected migration modules. /// /// When called without arguments `embed_migrations` searches for migration files on a directory called `migrations` at the root level of your crate. @@ -56,6 +93,7 @@ pub fn embed_migrations(input: TokenStream) -> TokenStream { let mut migrations_mods = Vec::new(); let mut _migrations = Vec::new(); + let mut migration_filenames = Vec::new(); for migration in migration_files { // safe to call unwrap as find_migration_filenames returns canonical paths @@ -65,6 +103,7 @@ pub fn embed_migrations(input: TokenStream) -> TokenStream { .unwrap(); let path = migration.display().to_string(); let extension = migration.extension().unwrap(); + migration_filenames.push(filename.clone()); if extension == "sql" { _migrations.push(quote! {(#filename, include_str!(#path).to_string())}); @@ -85,10 +124,12 @@ pub fn embed_migrations(input: TokenStream) -> TokenStream { } let fnq = migration_fn_quoted(_migrations); + let enums = migration_enum_quoted(migration_filenames.as_slice()); (quote! { pub mod migrations { #(#migrations_mods)* #fnq + #enums } }) .into() @@ -98,6 +139,27 @@ pub fn embed_migrations(input: TokenStream) -> TokenStream { mod tests { use super::{migration_fn_quoted, quote}; + #[test] + #[cfg(feature = "enums")] + fn test_enum_fn() { + let expected = concat! { + "# [repr (i32)] # [derive (Debug)] ", + "pub enum EmbeddedMigration { ", + "Foo (Migration) = 1i32 , ", + "BarBaz (Migration) = 3i32 ", + "} ", + "impl From < Migration > for EmbeddedMigration { ", + "fn from (migration : Migration) -> Self { ", + "match migration . version () as i32 { ", + "1i32 => Self :: Foo (migration) , ", + "3i32 => Self :: BarBaz (migration) , ", + "v => panic ! (\"Invalid migration version '{}'\" , v) ", + "} } }" + }; + let enums = super::migration_enum_quoted(&["V1__foo", "U3__barBAZ"]).to_string(); + assert_eq!(expected, enums); + } + #[test] fn test_quote_fn() { let migs = vec![quote!("V1__first", "valid_sql_file")]; From a20120a6007c5c199f5f84f46324f5a5056ff6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 29 Mar 2024 23:33:17 +0000 Subject: [PATCH 08/64] general: release 0.8.13 (#322) --- CHANGELOG.md | 19 ++++++++++++++++++- refinery/Cargo.toml | 6 +++--- refinery_cli/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 2 +- refinery_macros/Cargo.toml | 4 ++-- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec482b65..7ad2e76a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,26 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.8.12] - 2024-01-22 +## [0.8.13] - 2024-03-29 + +### Added +- Add new utility function, `load_sql_migrations` that enables dynamic migration discovery where embedding is not desirable. [#313](https://github.com/rust-db/refinery/pull/313) +- Add an enum `EmbeddedMigration` with all the migrations applied, [#312](https://github.com/rust-db/refinery/pull/312) + ### Changed +- Make serde, toml deps optional, [#310](https://github.com/rust-db/refinery/pull/310) +- Make `Migration::applied` `pub`, [#321](https://github.com/rust-db/refinery/pull/321) +- Update `rusqlite` to allow `0.31`, [#316](https://github.com/rust-db/refinery/pull/316) + +### Fixed +- Fix bug in get_last_applied_migration when refinery's schema history table is not default, [#313](https://github.com/rust-db/refinery/pull/313) +- Fix newline handling for Windows in database configuration setup, [#320](https://github.com/rust-db/refinery/pull/320) + +## [0.8.12] - 2024-01-22 +### Added - Add Iterable method, [#296](https://github.com/rust-db/refinery/pull/296) + +### Changed - Update `mysql` to allow `24`, [#292](https://github.com/rust-db/refinery/pull/292) - Update `mysql_async` to allow `0.33`, [#292](https://github.com/rust-db/refinery/pull/292) - Update `rusqlite` to allow `0.30`, [#300](https://github.com/rust-db/refinery/pull/300) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index c19ce8cf..37b275d4 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery" -version = "0.8.12" +version = "0.8.13" rust-version = "1.75" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" @@ -27,8 +27,8 @@ toml = ["refinery-core/toml"] enums = ["refinery-macros/enums"] [dependencies] -refinery-core = { version = "0.8.12", path = "../refinery_core" } -refinery-macros = { version = "0.8.12", path = "../refinery_macros" } +refinery-core = { version = "0.8.13", path = "../refinery_core" } +refinery-macros = { version = "0.8.13", path = "../refinery_macros" } [dev-dependencies] barrel = { git = "https://github.com/jxs/barrel", features = ["sqlite3", "pg", "mysql", "mssql"] } diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index 99b3eac5..08e14def 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery_cli" -version = "0.8.12" +version = "0.8.13" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT OR Apache-2.0" description = "Provides the CLI for the Refinery crate" @@ -23,7 +23,7 @@ sqlite-bundled = ["sqlite", "refinery-core/rusqlite-bundled"] mssql = ["refinery-core/tiberius-config", "tokio"] [dependencies] -refinery-core = { version = "0.8.12", path = "../refinery_core", default-features = false, features = ["toml"] } +refinery-core = { version = "0.8.13", path = "../refinery_core", default-features = false, features = ["toml"] } clap = { version = "4", features = ["derive"] } human-panic = "1.1.3" toml = "0.8" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 63adaa6e..f0c6b3ba 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-core" -version = "0.8.12" +version = "0.8.13" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 1ee1a0f1..0abad275 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-macros" -version = "0.8.12" +version = "0.8.13" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" @@ -15,7 +15,7 @@ enums = [] proc-macro = true [dependencies] -refinery-core = { version = "0.8.12", path = "../refinery_core" } +refinery-core = { version = "0.8.13", path = "../refinery_core" } quote = "1" syn = "2" proc-macro2 = "1" From eff4fc2fac2a743ebdcaf9ad30acec0f88f4c50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Wed, 3 Apr 2024 19:54:00 +0100 Subject: [PATCH 09/64] general: release 0.8.14 (#324) --- CHANGELOG.md | 6 +++++- refinery/Cargo.toml | 6 +++--- refinery_cli/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 2 +- refinery_macros/Cargo.toml | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ad2e76a..5a8feb52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.8.13] - 2024-03-29 +## [0.8.14] - 2024-03-29 ### Added - Add new utility function, `load_sql_migrations` that enables dynamic migration discovery where embedding is not desirable. [#313](https://github.com/rust-db/refinery/pull/313) @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix bug in get_last_applied_migration when refinery's schema history table is not default, [#313](https://github.com/rust-db/refinery/pull/313) - Fix newline handling for Windows in database configuration setup, [#320](https://github.com/rust-db/refinery/pull/320) +## [0.8.14] - 2024-03-29 + +- YANKED: due to release mismatch, see [#323](https://github.com/rust-db/refinery/issues/323). + ## [0.8.12] - 2024-01-22 ### Added - Add Iterable method, [#296](https://github.com/rust-db/refinery/pull/296) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 37b275d4..fce329ec 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery" -version = "0.8.13" +version = "0.8.14" rust-version = "1.75" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" @@ -27,8 +27,8 @@ toml = ["refinery-core/toml"] enums = ["refinery-macros/enums"] [dependencies] -refinery-core = { version = "0.8.13", path = "../refinery_core" } -refinery-macros = { version = "0.8.13", path = "../refinery_macros" } +refinery-core = { version = "0.8.14", path = "../refinery_core" } +refinery-macros = { version = "0.8.14", path = "../refinery_macros" } [dev-dependencies] barrel = { git = "https://github.com/jxs/barrel", features = ["sqlite3", "pg", "mysql", "mssql"] } diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index 08e14def..ac79a14e 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery_cli" -version = "0.8.13" +version = "0.8.14" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT OR Apache-2.0" description = "Provides the CLI for the Refinery crate" @@ -23,7 +23,7 @@ sqlite-bundled = ["sqlite", "refinery-core/rusqlite-bundled"] mssql = ["refinery-core/tiberius-config", "tokio"] [dependencies] -refinery-core = { version = "0.8.13", path = "../refinery_core", default-features = false, features = ["toml"] } +refinery-core = { version = "0.8.14", path = "../refinery_core", default-features = false, features = ["toml"] } clap = { version = "4", features = ["derive"] } human-panic = "1.1.3" toml = "0.8" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index f0c6b3ba..f8e2706f 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-core" -version = "0.8.13" +version = "0.8.14" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 0abad275..249ca6dc 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-macros" -version = "0.8.13" +version = "0.8.14" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" @@ -15,7 +15,7 @@ enums = [] proc-macro = true [dependencies] -refinery-core = { version = "0.8.13", path = "../refinery_core" } +refinery-core = { version = "0.8.14", path = "../refinery_core" } quote = "1" syn = "2" proc-macro2 = "1" From 423878147c3bee4ac3fc0e1262ce1443c2122462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 5 Apr 2024 21:24:18 +0100 Subject: [PATCH 10/64] fix CHANGELOG entries (#326) closes #325 --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a8feb52..884d5f1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.8.14] - 2024-03-29 +## [0.8.14] - 2024-04-03 ### Added - Add new utility function, `load_sql_migrations` that enables dynamic migration discovery where embedding is not desirable. [#313](https://github.com/rust-db/refinery/pull/313) @@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix bug in get_last_applied_migration when refinery's schema history table is not default, [#313](https://github.com/rust-db/refinery/pull/313) - Fix newline handling for Windows in database configuration setup, [#320](https://github.com/rust-db/refinery/pull/320) -## [0.8.14] - 2024-03-29 +## [0.8.13] - 2024-03-29 - YANKED: due to release mismatch, see [#323](https://github.com/rust-db/refinery/issues/323). From ff1c5c07c00f196e8ec4f10827ab882db2fd9d14 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Thu, 2 May 2024 17:10:57 +0800 Subject: [PATCH 11/64] add MySQL 0.34 support (#327) --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index f8e2706f..9f009554 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -33,7 +33,7 @@ rusqlite = { version = ">= 0.23, <= 0.31", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 24", optional = true, default-features = false, features = ["minimal"] } -mysql_async = { version = ">= 0.28, <= 0.33", optional = true, default-features = false, features = ["minimal"] } +mysql_async = { version = ">= 0.28, <= 0.34", optional = true, default-features = false, features = ["minimal"] } tiberius = { version = ">= 0.7, <= 0.12", optional = true, default-features = false } tokio = { version = "1.0", optional = true } futures = { version = "0.3.16", optional = true, features = ["async-await"] } From a2d6a61732d66a589642a87b8587d674f78e8f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 21 May 2024 11:21:33 +0100 Subject: [PATCH 12/64] add serde subfeature to tiberius-config (#334) --- Cargo.toml | 3 ++- refinery_core/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 687ee474..1b169f5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,9 @@ [workspace] +resolver = "2" members = [ "refinery", "refinery_cli", "refinery_core", "refinery_macros", - "examples" + "examples", ] diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 9f009554..c8cb46f0 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" default = [] rusqlite-bundled = ["rusqlite", "rusqlite/bundled"] tiberius = ["dep:tiberius", "futures", "tokio", "tokio/net"] -tiberius-config = ["tiberius", "tokio", "tokio-util"] +tiberius-config = ["tiberius", "tokio", "tokio-util", "serde"] tokio-postgres = ["dep:tokio-postgres", "tokio", "tokio/rt"] mysql_async = ["dep:mysql_async"] serde = ["dep:serde"] From 74d066fa6c2a5d5b4aa9d235e8489d4df63bf436 Mon Sep 17 00:00:00 2001 From: Matt Palmer Date: Tue, 21 May 2024 21:36:59 +1000 Subject: [PATCH 13/64] Allow Postgres tests to be run on a different database (#329) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allow Postgres tests to be run on a different database Not everyone has a "scratch" PostgreSQL running on localhost:5432 for refinery to scribble all over. Now you can specify an arbitrary PostgreSQL server to work on with the `DB_URI` environment variable (which appears to be what `refinery-cli` already uses) to test in. * Improve DB reset process * Use a more appropriate name for the function that does the work * Clean just the `public` schema, rather than drop/create the whole DB. This means that running the tests no longer requires superuser privs, and that we don't have to temporarily hide out in `template1`. * Drop the `catch_unwind`, because it's needed any more. --------- Co-authored-by: João Oliveira --- refinery/tests/postgres.rs | 107 +++++++++++++------------------------ 1 file changed, 38 insertions(+), 69 deletions(-) diff --git a/refinery/tests/postgres.rs b/refinery/tests/postgres.rs index 2ee4e756..59a263b8 100644 --- a/refinery/tests/postgres.rs +++ b/refinery/tests/postgres.rs @@ -5,13 +5,11 @@ mod postgres { use assert_cmd::prelude::*; use predicates::str::contains; use refinery::{ - config::{Config, ConfigDbType}, - embed_migrations, - error::Kind, - Migrate, Migration, Runner, Target, + config::Config, embed_migrations, error::Kind, Migrate, Migration, Runner, Target, }; use refinery_core::postgres::{Client, NoTls}; use std::process::Command; + use std::str::FromStr; use time::OffsetDateTime; const DEFAULT_TABLE_NAME: &str = "refinery_schema_history"; @@ -31,6 +29,10 @@ mod postgres { embed_migrations!("./tests/migrations_missing"); } + fn db_uri() -> String { + std::env::var("DB_URI").unwrap_or("postgres://postgres@localhost:5432/postgres".to_string()) + } + fn get_migrations() -> Vec { embed_migrations!("./tests/migrations"); @@ -64,36 +66,32 @@ mod postgres { vec![migration1, migration2, migration3, migration4, migration5] } - fn clean_database() { - let mut client = - Client::connect("postgres://postgres@localhost:5432/template1", NoTls).unwrap(); + fn prep_database() { + let uri = db_uri(); + + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); client - .execute( - "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='postgres'", - &[], - ) + .execute("DROP SCHEMA IF EXISTS public CASCADE", &[]) + .unwrap(); + client + .execute("CREATE SCHEMA IF NOT EXISTS public", &[]) .unwrap(); - client.execute("DROP DATABASE POSTGRES", &[]).unwrap(); - client.execute("CREATE DATABASE POSTGRES", &[]).unwrap(); } fn run_test(test: T) where - T: FnOnce() + std::panic::UnwindSafe, + T: FnOnce(), { - let result = std::panic::catch_unwind(test); - - clean_database(); + prep_database(); - assert!(result.is_ok()) + test(); } #[test] fn report_contains_applied_migrations() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); let report = embedded::migrations::runner().run(&mut client).unwrap(); @@ -122,8 +120,7 @@ mod postgres { #[test] fn creates_migration_table() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner().run(&mut client).unwrap(); for row in &client .query( @@ -144,8 +141,7 @@ mod postgres { #[test] fn creates_migration_table_grouped_transaction() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner() .set_grouped(true) @@ -171,8 +167,7 @@ mod postgres { #[test] fn applies_migration() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner().run(&mut client).unwrap(); client .execute( @@ -192,8 +187,7 @@ mod postgres { #[test] fn applies_migration_grouped_transaction() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner() .set_grouped(false) @@ -218,8 +212,7 @@ mod postgres { #[test] fn updates_schema_history() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner().run(&mut client).unwrap(); @@ -239,8 +232,7 @@ mod postgres { #[test] fn updates_schema_history_grouped_transaction() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner() .set_grouped(false) @@ -262,8 +254,7 @@ mod postgres { #[test] fn updates_to_last_working_if_not_grouped() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); let result = broken::migrations::runner().run(&mut client); @@ -300,8 +291,7 @@ mod postgres { #[test] fn doesnt_update_to_last_working_if_grouped() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); let result = broken::migrations::runner() .set_grouped(true) @@ -320,8 +310,7 @@ mod postgres { #[test] fn gets_applied_migrations() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner().run(&mut client).unwrap(); @@ -349,8 +338,7 @@ mod postgres { #[test] fn applies_new_migration() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner().run(&mut client).unwrap(); @@ -381,8 +369,7 @@ mod postgres { #[test] fn migrates_to_target_migration() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); let report = embedded::migrations::runner() .set_target(Target::Version(3)) @@ -417,8 +404,7 @@ mod postgres { #[test] fn migrates_to_target_migration_grouped() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); let report = embedded::migrations::runner() .set_target(Target::Version(3)) @@ -454,8 +440,7 @@ mod postgres { #[test] fn aborts_on_missing_migration_on_filesystem() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner().run(&mut client).unwrap(); @@ -488,8 +473,7 @@ mod postgres { #[test] fn aborts_on_divergent_migration() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); embedded::migrations::runner().run(&mut client).unwrap(); @@ -523,8 +507,7 @@ mod postgres { #[test] fn aborts_on_missing_migration_on_database() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); missing::migrations::runner().run(&mut client).unwrap(); @@ -568,11 +551,7 @@ mod postgres { #[test] fn migrates_from_config() { run_test(|| { - let mut config = Config::new(ConfigDbType::Postgres) - .set_db_name("postgres") - .set_db_user("postgres") - .set_db_host("localhost") - .set_db_port("5432"); + let mut config = Config::from_str(&db_uri()).unwrap(); let migrations = get_migrations(); let runner = Runner::new(&migrations) @@ -608,11 +587,7 @@ mod postgres { #[test] fn migrate_from_config_report_contains_migrations() { run_test(|| { - let mut config = Config::new(ConfigDbType::Postgres) - .set_db_name("postgres") - .set_db_user("postgres") - .set_db_host("localhost") - .set_db_port("5432"); + let mut config = Config::from_str(&db_uri()).unwrap(); let migrations = get_migrations(); let runner = Runner::new(&migrations) @@ -648,11 +623,7 @@ mod postgres { #[test] fn migrate_from_config_report_returns_last_applied_migration() { run_test(|| { - let mut config = Config::new(ConfigDbType::Postgres) - .set_db_name("postgres") - .set_db_user("postgres") - .set_db_host("localhost") - .set_db_port("5432"); + let mut config = Config::from_str(&db_uri()).unwrap(); let migrations = get_migrations(); let runner = Runner::new(&migrations) @@ -677,8 +648,7 @@ mod postgres { #[test] fn doesnt_run_migrations_if_fake() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); let report = embedded::migrations::runner() .set_target(Target::Fake) @@ -712,8 +682,7 @@ mod postgres { #[test] fn doesnt_run_migrations_if_fake_version() { run_test(|| { - let mut client = - Client::connect("postgres://postgres@localhost:5432/postgres", NoTls).unwrap(); + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); let report = embedded::migrations::runner() .set_target(Target::FakeVersion(2)) From 005df131468bd6e768e3b95dc3f514f9f476efe1 Mon Sep 17 00:00:00 2001 From: Pamplemousse Date: Fri, 24 May 2024 02:04:17 +0200 Subject: [PATCH 14/64] Enable math functions for SQLite (#335) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Enable math functions for SQLite * Update .cargo/config.toml --------- Co-authored-by: Pamplemousse Co-authored-by: João Oliveira --- .cargo/config.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..2a8b890d --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +LIBSQLITE3_FLAGS = { value = "-DSQLITE_ENABLE_MATH_FUNCTIONS", force = true } From ba37279190ed9fb593d57fa1dbcfb253728d5277 Mon Sep 17 00:00:00 2001 From: solc42 <19550062+solc42@users.noreply.github.com> Date: Sat, 8 Jun 2024 01:57:54 +0300 Subject: [PATCH 15/64] fix misleading CLI arguments descriptions (#336) --- refinery_cli/src/cli.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refinery_cli/src/cli.rs b/refinery_cli/src/cli.rs index fd188266..03d13593 100644 --- a/refinery_cli/src/cli.rs +++ b/refinery_cli/src/cli.rs @@ -44,11 +44,11 @@ pub struct MigrateArgs { #[clap(long, default_value = "refinery_schema_history")] pub table_name: String, - /// Migrate even if divergent migrations are found + /// Should abort if divergent migrations are found #[clap(short)] pub divergent: bool, - /// Migrate even if missing migrations are found + /// Should abort if missing migrations are found #[clap(short)] pub missing: bool, } From 394f0f882561c2619b059b3aecb73f44d4c63ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 9 Jul 2024 23:52:24 +0000 Subject: [PATCH 16/64] update dependencies (#340) --- examples/Cargo.toml | 2 +- refinery_cli/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 2 +- refinery_macros/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 4914afeb..2a9d6037 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -13,7 +13,7 @@ enums = ["refinery/enums"] [dependencies] refinery = { path = "../refinery", features = ["rusqlite"] } -rusqlite = "0.29" +rusqlite = "0.31" barrel = { version = "0.7", features = ["sqlite3"] } log = "0.4" env_logger = "0.11" \ No newline at end of file diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index ac79a14e..e6bca7d8 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -25,9 +25,9 @@ mssql = ["refinery-core/tiberius-config", "tokio"] [dependencies] refinery-core = { version = "0.8.14", path = "../refinery_core", default-features = false, features = ["toml"] } clap = { version = "4", features = ["derive"] } -human-panic = "1.1.3" +human-panic = "2" toml = "0.8" -env_logger = "0.10" +env_logger = "0.11" log = "0.4" anyhow = "1" regex = "1" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index c8cb46f0..05f2045e 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -32,7 +32,7 @@ walkdir = "2.3.1" rusqlite = { version = ">= 0.23, <= 0.31", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } -mysql = { version = ">= 21.0.0, <= 24", optional = true, default-features = false, features = ["minimal"] } +mysql = { version = ">= 21.0.0, <= 25", optional = true, default-features = false, features = ["minimal"] } mysql_async = { version = ">= 0.28, <= 0.34", optional = true, default-features = false, features = ["minimal"] } tiberius = { version = ">= 0.7, <= 0.12", optional = true, default-features = false } tokio = { version = "1.0", optional = true } diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 249ca6dc..3907f378 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -20,7 +20,7 @@ quote = "1" syn = "2" proc-macro2 = "1" regex = "1" -heck = "0.4" +heck = "0.5" [dev-dependencies] tempfile = "3" From b09e3cf08880d4fabf167688dcada61ec5bcc49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 2 Aug 2024 14:07:20 +0100 Subject: [PATCH 17/64] update READAME.md (#342) remove no longer required async section and mention external drivers --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bac63cdd..46fbabd9 100644 --- a/README.md +++ b/README.md @@ -95,15 +95,18 @@ By default, refinery runs each migration in a single transaction. Alternatively, refinery's design was based on [flyway](https://flywaydb.org/) and so, it shares its earlier [philosophy](https://web.archive.org/web/20191226033347/https://flywaydb.org/documentation/command/undo#important-notes) on undo/rollback migrations. Flyway has since changed it's opinion but refinery hasn't. To undo/rollback a migration, you have to generate a new one and write specifically what you want to undo. -## MSRV +## Support for Additional Database Drivers -refinery aims to support stable Rust, the previous Rust version, and nightly. +While initially it seemed beneficial to support as many aditional drivers as possible in this repo, with the current bandwidth available by the maintainers it's preferable to create them and maintain them on external repositories (see [here](https://github.com/rust-db/refinery/pull/264#issuecomment-1419198667) for context). + +Notable external database drivers: + +- [Klickhouse](https://github.com/Protryon/klickhouse) ([Clickhouse](https://clickhouse.tech/docs/en/) database driver with refinery support) -## Async -Starting with version 0.2 refinery supports [tokio-postgres](https://crates.io/crates/tokio-postgres), [`mysql_async`](https://crates.io/crates/mysql_async) -and [Tiberius](https://github.com/prisma/tiberius) -For Rusqlite, the best way to run migrations in an async context is to run them inside tokio's [`spawn_blocking`](https://docs.rs/tokio/1.10.0/tokio/task/fn.spawn_blocking.html) for example. +## MSRV + +refinery aims to support stable Rust, the previous Rust version, and nightly. ## Contributing From 068858ead1381e24042a85fa94523f69a7f5ca4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Sat, 3 Aug 2024 10:16:42 +0100 Subject: [PATCH 18/64] update migrate Transaction and AsyncTransaction execute functions (#346) This allows avoiding double iteration when calling migrate with the grouped option active --- refinery_core/Cargo.toml | 2 +- refinery_core/src/drivers/config.rs | 10 +++++-- refinery_core/src/drivers/mysql.rs | 14 ++++++--- refinery_core/src/drivers/mysql_async.rs | 7 +++-- refinery_core/src/drivers/postgres.rs | 7 +++-- refinery_core/src/drivers/rusqlite.rs | 7 +++-- refinery_core/src/drivers/tiberius.rs | 7 +++-- refinery_core/src/drivers/tokio_postgres.rs | 5 +++- refinery_core/src/traits/async.rs | 29 ++++++++++++------- refinery_core/src/traits/sync.rs | 32 ++++++++++++--------- 10 files changed, 81 insertions(+), 39 deletions(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 05f2045e..3746a39a 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -6,7 +6,7 @@ description = "This crate should not be used directly, it is internally related license = "MIT OR Apache-2.0" documentation = "https://docs.rs/refinery/" repository = "https://github.com/rust-db/refinery" -edition = "2018" +edition = "2021" [features] default = [] diff --git a/refinery_core/src/drivers/config.rs b/refinery_core/src/drivers/config.rs index 639ff108..bc95b572 100644 --- a/refinery_core/src/drivers/config.rs +++ b/refinery_core/src/drivers/config.rs @@ -18,7 +18,10 @@ use std::convert::Infallible; impl Transaction for Config { type Error = Infallible; - fn execute(&mut self, _queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + _queries: T, + ) -> Result { Ok(0) } } @@ -33,7 +36,10 @@ impl Query> for Config { impl AsyncTransaction for Config { type Error = Infallible; - async fn execute(&mut self, _queries: &[&str]) -> Result { + async fn execute<'a, T: Iterator + Send>( + &mut self, + _queries: T, + ) -> Result { Ok(0) } } diff --git a/refinery_core/src/drivers/mysql.rs b/refinery_core/src/drivers/mysql.rs index 33148d94..c2947152 100644 --- a/refinery_core/src/drivers/mysql.rs +++ b/refinery_core/src/drivers/mysql.rs @@ -43,10 +43,13 @@ fn query_applied_migrations( impl Transaction for Conn { type Error = MError; - fn execute(&mut self, queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result { let mut transaction = self.start_transaction(get_tx_opts())?; let mut count = 0; - for query in queries.iter() { + for query in queries { transaction.query_iter(query)?; count += 1; } @@ -58,11 +61,14 @@ impl Transaction for Conn { impl Transaction for PooledConn { type Error = MError; - fn execute(&mut self, queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result { let mut transaction = self.start_transaction(get_tx_opts())?; let mut count = 0; - for query in queries.iter() { + for query in queries { transaction.query_iter(query)?; count += 1; } diff --git a/refinery_core/src/drivers/mysql_async.rs b/refinery_core/src/drivers/mysql_async.rs index 101ab0ab..3f8aaac2 100644 --- a/refinery_core/src/drivers/mysql_async.rs +++ b/refinery_core/src/drivers/mysql_async.rs @@ -39,7 +39,10 @@ async fn query_applied_migrations<'a>( impl AsyncTransaction for Pool { type Error = MError; - async fn execute(&mut self, queries: &[&str]) -> Result { + async fn execute<'a, T: Iterator + Send>( + &mut self, + queries: T, + ) -> Result { let mut conn = self.get_conn().await?; let mut options = TxOpts::new(); options.with_isolation_level(Some(IsolationLevel::ReadCommitted)); @@ -47,7 +50,7 @@ impl AsyncTransaction for Pool { let mut transaction = conn.start_transaction(options).await?; let mut count = 0; for query in queries { - transaction.query_drop(*query).await?; + transaction.query_drop(query).await?; count += 1; } transaction.commit().await?; diff --git a/refinery_core/src/drivers/postgres.rs b/refinery_core/src/drivers/postgres.rs index 3d177509..fa4d5b9e 100644 --- a/refinery_core/src/drivers/postgres.rs +++ b/refinery_core/src/drivers/postgres.rs @@ -33,10 +33,13 @@ fn query_applied_migrations( impl Transaction for PgClient { type Error = PgError; - fn execute(&mut self, queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result { let mut transaction = PgClient::transaction(self)?; let mut count = 0; - for query in queries.iter() { + for query in queries { PgTransaction::batch_execute(&mut transaction, query)?; count += 1; } diff --git a/refinery_core/src/drivers/rusqlite.rs b/refinery_core/src/drivers/rusqlite.rs index 9547ba48..9ee4ced9 100644 --- a/refinery_core/src/drivers/rusqlite.rs +++ b/refinery_core/src/drivers/rusqlite.rs @@ -32,10 +32,13 @@ fn query_applied_migrations( impl Transaction for RqlConnection { type Error = RqlError; - fn execute(&mut self, queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result { let transaction = self.transaction()?; let mut count = 0; - for query in queries.iter() { + for query in queries { transaction.execute_batch(query)?; count += 1; } diff --git a/refinery_core/src/drivers/tiberius.rs b/refinery_core/src/drivers/tiberius.rs index 117c6344..8cab422a 100644 --- a/refinery_core/src/drivers/tiberius.rs +++ b/refinery_core/src/drivers/tiberius.rs @@ -46,13 +46,16 @@ where { type Error = Error; - async fn execute(&mut self, queries: &[&str]) -> Result { + async fn execute<'a, T: Iterator + Send>( + &mut self, + queries: T, + ) -> Result { // Tiberius doesn't support transactions, see https://github.com/prisma/tiberius/issues/28 self.simple_query("BEGIN TRAN T1;").await?; let mut count = 0; for query in queries { // Drop the returning `QueryStream<'a>` to avoid compiler complaning regarding lifetimes - if let Err(err) = self.simple_query(*query).await.map(drop) { + if let Err(err) = self.simple_query(query).await.map(drop) { if let Err(err) = self.simple_query("ROLLBACK TRAN T1").await { log::error!("could not ROLLBACK transaction, {}", err); } diff --git a/refinery_core/src/drivers/tokio_postgres.rs b/refinery_core/src/drivers/tokio_postgres.rs index ec8bb9c8..346cfd7c 100644 --- a/refinery_core/src/drivers/tokio_postgres.rs +++ b/refinery_core/src/drivers/tokio_postgres.rs @@ -35,7 +35,10 @@ async fn query_applied_migrations( impl AsyncTransaction for Client { type Error = PgError; - async fn execute(&mut self, queries: &[&str]) -> Result { + async fn execute<'a, T: Iterator + Send>( + &mut self, + queries: T, + ) -> Result { let transaction = self.transaction().await?; let mut count = 0; for query in queries { diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index 75621449..8af3430f 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -6,13 +6,17 @@ use crate::traits::{ use crate::{Error, Migration, Report, Target}; use async_trait::async_trait; +use std::ops::Deref; use std::string::ToString; #[async_trait] pub trait AsyncTransaction { type Error: std::error::Error + Send + Sync + 'static; - async fn execute(&mut self, query: &[&str]) -> Result; + async fn execute<'a, T: Iterator + Send>( + &mut self, + queries: T, + ) -> Result; } #[async_trait] @@ -43,10 +47,13 @@ async fn migrate( migration.set_applied(); let update_query = insert_migration_query(&migration, migration_table_name); transaction - .execute(&[ - migration.sql().as_ref().expect("sql must be Some!"), - &update_query, - ]) + .execute( + [ + migration.sql().as_ref().expect("sql must be Some!"), + update_query.as_str(), + ] + .into_iter(), + ) .await .migration_err( &format!("error applying migration {}", migration), @@ -105,10 +112,10 @@ async fn migrate_grouped( ); } - let refs: Vec<&str> = grouped_migrations.iter().map(AsRef::as_ref).collect(); + let refs = grouped_migrations.iter().map(AsRef::as_ref); transaction - .execute(refs.as_ref()) + .execute(refs) .await .migration_err("error applying migrations", None)?; @@ -164,9 +171,11 @@ where target: Target, migration_table_name: &str, ) -> Result { - self.execute(&[&Self::assert_migrations_table_query(migration_table_name)]) - .await - .migration_err("error asserting migrations table", None)?; + self.execute( + [Self::assert_migrations_table_query(migration_table_name).as_str()].into_iter(), + ) + .await + .migration_err("error asserting migrations table", None)?; let applied_migrations = self .query( diff --git a/refinery_core/src/traits/sync.rs b/refinery_core/src/traits/sync.rs index 58238c0d..7e552b2b 100644 --- a/refinery_core/src/traits/sync.rs +++ b/refinery_core/src/traits/sync.rs @@ -1,3 +1,5 @@ +use std::ops::Deref; + use crate::error::WrapMigrationError; use crate::traits::{ insert_migration_query, verify_migrations, ASSERT_MIGRATIONS_TABLE_QUERY, @@ -8,7 +10,10 @@ use crate::{Error, Migration, Report, Target}; pub trait Transaction { type Error: std::error::Error + Send + Sync + 'static; - fn execute(&mut self, queries: &[&str]) -> Result; + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result; } pub trait Query: Transaction { @@ -20,7 +25,7 @@ pub fn migrate( migrations: Vec, target: Target, migration_table_name: &str, - batched: bool, + grouped: bool, ) -> Result { let mut migration_batch = Vec::new(); let mut applied_migrations = Vec::new(); @@ -49,7 +54,7 @@ pub fn migrate( migration_batch.push(insert_migration); } - match (target, batched) { + match (target, grouped) { (Target::Fake | Target::FakeVersion(_), _) => { log::info!("not going to apply any migration as fake flag is enabled"); } @@ -68,16 +73,14 @@ pub fn migrate( } }; - let refs: Vec<&str> = migration_batch.iter().map(AsRef::as_ref).collect(); - - if batched { + if grouped { transaction - .execute(refs.as_ref()) + .execute(migration_batch.iter().map(Deref::deref)) .migration_err("error applying migrations", None)?; } else { - for (i, update) in refs.iter().enumerate() { + for (i, update) in migration_batch.into_iter().enumerate() { transaction - .execute(&[update]) + .execute([update.as_str()].into_iter()) .migration_err("error applying update", Some(&applied_migrations[0..i / 2]))?; } } @@ -92,10 +95,13 @@ where fn assert_migrations_table(&mut self, migration_table_name: &str) -> Result { // Needed cause some database vendors like Mssql have a non sql standard way of checking the migrations table, // thou on this case it's just to be consistent with the async trait `AsyncMigrate` - self.execute(&[ASSERT_MIGRATIONS_TABLE_QUERY - .replace("%MIGRATION_TABLE_NAME%", migration_table_name) - .as_str()]) - .migration_err("error asserting migrations table", None) + self.execute( + [ASSERT_MIGRATIONS_TABLE_QUERY + .replace("%MIGRATION_TABLE_NAME%", migration_table_name) + .as_str()] + .into_iter(), + ) + .migration_err("error asserting migrations table", None) } fn get_last_applied_migration( From 8e120f6cb866940c9ebe843cdc6a837bcf56bad8 Mon Sep 17 00:00:00 2001 From: manuteleco Date: Thu, 10 Oct 2024 14:49:14 +0200 Subject: [PATCH 19/64] Support `rusqlite` 0.32.x (#347) --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 3746a39a..d59e9130 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -29,7 +29,7 @@ url = "2.0" walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar -rusqlite = { version = ">= 0.23, <= 0.31", optional = true } +rusqlite = { version = ">= 0.23, <= 0.32", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 25", optional = true, default-features = false, features = ["minimal"] } From 481519bc810630a1a2a2e2561c669027d750e73b Mon Sep 17 00:00:00 2001 From: Hugh O'Brien Date: Mon, 3 Feb 2025 09:10:31 -0500 Subject: [PATCH 20/64] README: add bb8 example (#356) --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 46fbabd9..16ef4042 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,13 @@ let client = conn.deref_mut().deref_mut(); let report = embedded::migrations::runner().run_async(client).await?; ``` +### Example: bb8 + +```rust +let mut client = pool.dedicated_connection().await?; +let report = embedded::migrations::runner().run_async(&mut client).await?; +``` + ### Non-contiguous VS Contiguous migrations Depending on how your project/team has been structured will define whether you want to use contiguous (adjacent) migrations `V{1}__{2}.[sql|rs]` or non-contiguous (not adjacent) migrations `U{1}__{2}.[sql|rs]`. From 541b83b3e8a87ff35116b0dfe6ebbe193fd9c79d Mon Sep 17 00:00:00 2001 From: Youser Nayme <51252915+NeuralModder@users.noreply.github.com> Date: Sun, 16 Feb 2025 10:56:03 +0000 Subject: [PATCH 21/64] Support `rusqlite` 0.33.x (#361) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Youser Nayme <7685106-NeutralModder@users.noreply.gitlab.com> Co-authored-by: João Oliveira --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index d59e9130..d21a6180 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -29,7 +29,7 @@ url = "2.0" walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar -rusqlite = { version = ">= 0.23, <= 0.32", optional = true } +rusqlite = { version = ">= 0.23, <= 0.33", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 25", optional = true, default-features = false, features = ["minimal"] } From 64b6589fa21a78ce93dfdab70361f85cbc64e06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 18 Feb 2025 11:54:32 +0000 Subject: [PATCH 22/64] fix tiberius tests (#364) --- .github/workflows/ci.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 120dda86..138651d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,16 +174,12 @@ jobs: strategy: matrix: rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} - services: - mssql: - image: mcr.microsoft.com/mssql/server:2017-latest - ports: - - 1433:1433 - env: - ACCEPT_EULA: yes - SA_PASSWORD: Passw0rd steps: - uses: actions/checkout@v2 + - uses: potatoqualitee/mssqlsuite@v1.8 + with: + install: sqlengine, sqlpackage + sa-password: Passw0rd - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} From 154ffc895a1f6f5100d808b1406a96dba2c3b0fa Mon Sep 17 00:00:00 2001 From: Rob McGregor <45047735+dkintheuk@users.noreply.github.com> Date: Tue, 18 Feb 2025 12:03:49 +0000 Subject: [PATCH 23/64] Bump maximum mysql_async version (#359) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robert McGregor Co-authored-by: João Oliveira --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index d21a6180..9cde9c17 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -33,7 +33,7 @@ rusqlite = { version = ">= 0.23, <= 0.33", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 25", optional = true, default-features = false, features = ["minimal"] } -mysql_async = { version = ">= 0.28, <= 0.34", optional = true, default-features = false, features = ["minimal"] } +mysql_async = { version = ">= 0.28, <= 0.35", optional = true, default-features = false, features = ["minimal"] } tiberius = { version = ">= 0.7, <= 0.12", optional = true, default-features = false } tokio = { version = "1.0", optional = true } futures = { version = "0.3.16", optional = true, features = ["async-await"] } From cbdece55a6e2f300c390359131c5bfb11cafa69f Mon Sep 17 00:00:00 2001 From: masato-hi Date: Tue, 18 Feb 2025 21:14:40 +0900 Subject: [PATCH 24/64] Make a query overridable. (#358) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Oliveira --- refinery_core/src/runner.rs | 2 +- refinery_core/src/traits/async.rs | 23 +++++++++++------------ refinery_core/src/traits/sync.rs | 28 ++++++++++++++++------------ 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/refinery_core/src/runner.rs b/refinery_core/src/runner.rs index 46d4d714..af8e2ab5 100644 --- a/refinery_core/src/runner.rs +++ b/refinery_core/src/runner.rs @@ -204,7 +204,7 @@ pub struct Report { impl Report { /// Instantiate a new Report - pub(crate) fn new(applied_migrations: Vec) -> Report { + pub fn new(applied_migrations: Vec) -> Report { Report { applied_migrations } } diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index 8af3430f..32908b83 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -132,15 +132,20 @@ where ASSERT_MIGRATIONS_TABLE_QUERY.replace("%MIGRATION_TABLE_NAME%", migration_table_name) } + fn get_last_applied_migration_query(migration_table_name: &str) -> String { + GET_LAST_APPLIED_MIGRATION_QUERY.replace("%MIGRATION_TABLE_NAME%", migration_table_name) + } + + fn get_applied_migrations_query(migration_table_name: &str) -> String { + GET_APPLIED_MIGRATIONS_QUERY.replace("%MIGRATION_TABLE_NAME%", migration_table_name) + } + async fn get_last_applied_migration( &mut self, migration_table_name: &str, ) -> Result, Error> { let mut migrations = self - .query( - &GET_LAST_APPLIED_MIGRATION_QUERY - .replace("%MIGRATION_TABLE_NAME%", migration_table_name), - ) + .query(Self::get_last_applied_migration_query(migration_table_name).as_str()) .await .migration_err("error getting last applied migration", None)?; @@ -152,10 +157,7 @@ where migration_table_name: &str, ) -> Result, Error> { let migrations = self - .query( - &GET_APPLIED_MIGRATIONS_QUERY - .replace("%MIGRATION_TABLE_NAME%", migration_table_name), - ) + .query(Self::get_applied_migrations_query(migration_table_name).as_str()) .await .migration_err("error getting applied migrations", None)?; @@ -178,10 +180,7 @@ where .migration_err("error asserting migrations table", None)?; let applied_migrations = self - .query( - &GET_APPLIED_MIGRATIONS_QUERY - .replace("%MIGRATION_TABLE_NAME%", migration_table_name), - ) + .get_applied_migrations(migration_table_name) .await .migration_err("error getting current schema version", None)?; diff --git a/refinery_core/src/traits/sync.rs b/refinery_core/src/traits/sync.rs index 7e552b2b..bf761035 100644 --- a/refinery_core/src/traits/sync.rs +++ b/refinery_core/src/traits/sync.rs @@ -92,14 +92,24 @@ pub trait Migrate: Query> where Self: Sized, { + // Needed cause some database vendors like Mssql have a non sql standard way of checking the migrations table + fn assert_migrations_table_query(migration_table_name: &str) -> String { + ASSERT_MIGRATIONS_TABLE_QUERY.replace("%MIGRATION_TABLE_NAME%", migration_table_name) + } + + fn get_last_applied_migration_query(migration_table_name: &str) -> String { + GET_LAST_APPLIED_MIGRATION_QUERY.replace("%MIGRATION_TABLE_NAME%", migration_table_name) + } + + fn get_applied_migrations_query(migration_table_name: &str) -> String { + GET_APPLIED_MIGRATIONS_QUERY.replace("%MIGRATION_TABLE_NAME%", migration_table_name) + } + fn assert_migrations_table(&mut self, migration_table_name: &str) -> Result { // Needed cause some database vendors like Mssql have a non sql standard way of checking the migrations table, // thou on this case it's just to be consistent with the async trait `AsyncMigrate` self.execute( - [ASSERT_MIGRATIONS_TABLE_QUERY - .replace("%MIGRATION_TABLE_NAME%", migration_table_name) - .as_str()] - .into_iter(), + [Self::assert_migrations_table_query(migration_table_name).as_str()].into_iter(), ) .migration_err("error asserting migrations table", None) } @@ -109,10 +119,7 @@ where migration_table_name: &str, ) -> Result, Error> { let mut migrations = self - .query( - &GET_LAST_APPLIED_MIGRATION_QUERY - .replace("%MIGRATION_TABLE_NAME%", migration_table_name), - ) + .query(Self::get_last_applied_migration_query(migration_table_name).as_str()) .migration_err("error getting last applied migration", None)?; Ok(migrations.pop()) @@ -123,10 +130,7 @@ where migration_table_name: &str, ) -> Result, Error> { let migrations = self - .query( - &GET_APPLIED_MIGRATIONS_QUERY - .replace("%MIGRATION_TABLE_NAME%", migration_table_name), - ) + .query(Self::get_applied_migrations_query(migration_table_name).as_str()) .migration_err("error getting applied migrations", None)?; Ok(migrations) From 1c9e0ca66727ea49db386c60b4bb7f699eb13a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 18 Feb 2025 15:36:53 +0000 Subject: [PATCH 25/64] bump mysql dependency (#365) --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 9cde9c17..8fcfb619 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -32,7 +32,7 @@ walkdir = "2.3.1" rusqlite = { version = ">= 0.23, <= 0.33", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } -mysql = { version = ">= 21.0.0, <= 25", optional = true, default-features = false, features = ["minimal"] } +mysql = { version = ">= 21.0.0, <= 26", optional = true, default-features = false, features = ["minimal"] } mysql_async = { version = ">= 0.28, <= 0.35", optional = true, default-features = false, features = ["minimal"] } tiberius = { version = ">= 0.7, <= 0.12", optional = true, default-features = false } tokio = { version = "1.0", optional = true } From 3df41dfed0f864503bf915a24f0e8e59bb5baeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 18 Feb 2025 18:05:48 +0000 Subject: [PATCH 26/64] cargo clippy (#366) --- refinery_core/Cargo.toml | 2 +- refinery_core/src/traits/async.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 8fcfb619..7e40557a 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-core" -version = "0.8.14" +version = "0.8.15" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index 32908b83..8831041f 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -6,7 +6,6 @@ use crate::traits::{ use crate::{Error, Migration, Report, Target}; use async_trait::async_trait; -use std::ops::Deref; use std::string::ToString; #[async_trait] From a4a858c3d93b2b56dd45af90861a06c0bbbde79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 18 Feb 2025 18:22:34 +0000 Subject: [PATCH 27/64] cargo clippy (#367) --- examples/src/main.rs | 1 - refinery/tests/mysql_async.rs | 4 ++-- refinery/tests/postgres.rs | 2 -- refinery_core/src/util.rs | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/src/main.rs b/examples/src/main.rs index 88772344..7b650639 100644 --- a/examples/src/main.rs +++ b/examples/src/main.rs @@ -1,4 +1,3 @@ -use barrel::backend::Sqlite as Sql; use log::info; use refinery::Migration; use rusqlite::Connection; diff --git a/refinery/tests/mysql_async.rs b/refinery/tests/mysql_async.rs index 4b3e9cff..a3892ae4 100644 --- a/refinery/tests/mysql_async.rs +++ b/refinery/tests/mysql_async.rs @@ -94,7 +94,7 @@ mod mysql_async { .await .unwrap(); - conn.query(&format!( + conn.query(format!( "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", DEFAULT_TABLE_NAME )) @@ -122,7 +122,7 @@ mod mysql_async { .unwrap(); let result = conn - .query(&format!( + .query(format!( "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", DEFAULT_TABLE_NAME )) diff --git a/refinery/tests/postgres.rs b/refinery/tests/postgres.rs index 59a263b8..ec10a2c8 100644 --- a/refinery/tests/postgres.rs +++ b/refinery/tests/postgres.rs @@ -67,8 +67,6 @@ mod postgres { } fn prep_database() { - let uri = db_uri(); - let mut client = Client::connect(&db_uri(), NoTls).unwrap(); client diff --git a/refinery_core/src/util.rs b/refinery_core/src/util.rs index 24a2c65d..4b416f45 100644 --- a/refinery_core/src/util.rs +++ b/refinery_core/src/util.rs @@ -7,7 +7,7 @@ use std::path::{Path, PathBuf}; use std::sync::OnceLock; use walkdir::{DirEntry, WalkDir}; -const STEM_RE: &'static str = r"^([U|V])(\d+(?:\.\d+)?)__(\w+)"; +const STEM_RE: &str = r"^([U|V])(\d+(?:\.\d+)?)__(\w+)"; /// Matches the stem of a migration file. fn file_stem_re() -> &'static Regex { From 042124ed42d23c777a7d2186660a9db589ddabd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 18 Feb 2025 18:54:30 +0000 Subject: [PATCH 28/64] release 0.8.15 (#368) --- CHANGELOG.md | 18 ++++++++++++++++++ refinery/Cargo.toml | 6 +++--- refinery_cli/Cargo.toml | 4 ++-- refinery_macros/Cargo.toml | 4 ++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 884d5f1c..6eb2603d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.8.15] - 2024-02-18 + +### Added +- Make a query overridable. [#358](https://github.com/rust-db/refinery/pull/358) +- Enable math functions for SQLite. [#335](https://github.com/rust-db/refinery/pull/335) +- Add serde subfeature to tiberius-config. [#334](https://github.com/rust-db/refinery/pull/334) + +### Changed +- Update `mysql` version to allow `26`, [#365](https://github.com/rust-db/refinery/pull/365) +- Update `mysql_async` to allow `0.35`, [#359](https://github.com/rust-db/refinery/pull/359) +- Update `rusqlite` to allow `0.33`, [#361](https://github.com/rust-db/refinery/pull/361) +- Update migrate Transaction and AsyncTransaction execute functions to avoid double iteration when calling migrate with the grouped option active. [#346](https://github.com/rust-db/refinery/pull/346) +- Update overall dependencies. [#340](https://github.com/rust-db/refinery/pull/340) + +### Fixed +- Fix misleading CLI arguments descriptions [#336](https://github.com/rust-db/refinery/pull/336) + + ## [0.8.14] - 2024-04-03 ### Added diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index fce329ec..dd51d5d3 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery" -version = "0.8.14" +version = "0.8.15" rust-version = "1.75" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" @@ -27,8 +27,8 @@ toml = ["refinery-core/toml"] enums = ["refinery-macros/enums"] [dependencies] -refinery-core = { version = "0.8.14", path = "../refinery_core" } -refinery-macros = { version = "0.8.14", path = "../refinery_macros" } +refinery-core = { version = "0.8.15", path = "../refinery_core" } +refinery-macros = { version = "0.8.15", path = "../refinery_macros" } [dev-dependencies] barrel = { git = "https://github.com/jxs/barrel", features = ["sqlite3", "pg", "mysql", "mssql"] } diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index e6bca7d8..4da48f81 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery_cli" -version = "0.8.14" +version = "0.8.15" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT OR Apache-2.0" description = "Provides the CLI for the Refinery crate" @@ -23,7 +23,7 @@ sqlite-bundled = ["sqlite", "refinery-core/rusqlite-bundled"] mssql = ["refinery-core/tiberius-config", "tokio"] [dependencies] -refinery-core = { version = "0.8.14", path = "../refinery_core", default-features = false, features = ["toml"] } +refinery-core = { version = "0.8.15", path = "../refinery_core", default-features = false, features = ["toml"] } clap = { version = "4", features = ["derive"] } human-panic = "2" toml = "0.8" diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 3907f378..087619d3 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-macros" -version = "0.8.14" +version = "0.8.15" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" @@ -15,7 +15,7 @@ enums = [] proc-macro = true [dependencies] -refinery-core = { version = "0.8.14", path = "../refinery_core" } +refinery-core = { version = "0.8.15", path = "../refinery_core" } quote = "1" syn = "2" proc-macro2 = "1" From 936af4c7fef45a6b73ae99479ee0578ca53acc67 Mon Sep 17 00:00:00 2001 From: Alexander Zaitsev Date: Thu, 20 Feb 2025 18:33:15 +0300 Subject: [PATCH 29/64] feat: enable LTO and codegen-units = 1 optimizations (#369) --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 1b169f5e..9cd4a9ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,7 @@ members = [ "refinery_macros", "examples", ] + +[profile.release] +codegen-units = 1 +lto = true From c8b9b6ac5916b1aa43cc9f2d246db1942a1e7f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 21 Feb 2025 11:26:40 +0000 Subject: [PATCH 30/64] revert Transaction and AsyncTransaction function signatures update (#370) --- refinery_core/src/drivers/config.rs | 10 ++------ refinery_core/src/drivers/mysql.rs | 14 +++-------- refinery_core/src/drivers/mysql_async.rs | 7 ++---- refinery_core/src/drivers/postgres.rs | 7 ++---- refinery_core/src/drivers/rusqlite.rs | 7 ++---- refinery_core/src/drivers/tiberius.rs | 7 ++---- refinery_core/src/drivers/tokio_postgres.rs | 5 +--- refinery_core/src/traits/async.rs | 28 ++++++++------------- refinery_core/src/traits/sync.rs | 27 ++++++++------------ 9 files changed, 36 insertions(+), 76 deletions(-) diff --git a/refinery_core/src/drivers/config.rs b/refinery_core/src/drivers/config.rs index bc95b572..639ff108 100644 --- a/refinery_core/src/drivers/config.rs +++ b/refinery_core/src/drivers/config.rs @@ -18,10 +18,7 @@ use std::convert::Infallible; impl Transaction for Config { type Error = Infallible; - fn execute<'a, T: Iterator>( - &mut self, - _queries: T, - ) -> Result { + fn execute(&mut self, _queries: &[&str]) -> Result { Ok(0) } } @@ -36,10 +33,7 @@ impl Query> for Config { impl AsyncTransaction for Config { type Error = Infallible; - async fn execute<'a, T: Iterator + Send>( - &mut self, - _queries: T, - ) -> Result { + async fn execute(&mut self, _queries: &[&str]) -> Result { Ok(0) } } diff --git a/refinery_core/src/drivers/mysql.rs b/refinery_core/src/drivers/mysql.rs index c2947152..33148d94 100644 --- a/refinery_core/src/drivers/mysql.rs +++ b/refinery_core/src/drivers/mysql.rs @@ -43,13 +43,10 @@ fn query_applied_migrations( impl Transaction for Conn { type Error = MError; - fn execute<'a, T: Iterator>( - &mut self, - queries: T, - ) -> Result { + fn execute(&mut self, queries: &[&str]) -> Result { let mut transaction = self.start_transaction(get_tx_opts())?; let mut count = 0; - for query in queries { + for query in queries.iter() { transaction.query_iter(query)?; count += 1; } @@ -61,14 +58,11 @@ impl Transaction for Conn { impl Transaction for PooledConn { type Error = MError; - fn execute<'a, T: Iterator>( - &mut self, - queries: T, - ) -> Result { + fn execute(&mut self, queries: &[&str]) -> Result { let mut transaction = self.start_transaction(get_tx_opts())?; let mut count = 0; - for query in queries { + for query in queries.iter() { transaction.query_iter(query)?; count += 1; } diff --git a/refinery_core/src/drivers/mysql_async.rs b/refinery_core/src/drivers/mysql_async.rs index 3f8aaac2..101ab0ab 100644 --- a/refinery_core/src/drivers/mysql_async.rs +++ b/refinery_core/src/drivers/mysql_async.rs @@ -39,10 +39,7 @@ async fn query_applied_migrations<'a>( impl AsyncTransaction for Pool { type Error = MError; - async fn execute<'a, T: Iterator + Send>( - &mut self, - queries: T, - ) -> Result { + async fn execute(&mut self, queries: &[&str]) -> Result { let mut conn = self.get_conn().await?; let mut options = TxOpts::new(); options.with_isolation_level(Some(IsolationLevel::ReadCommitted)); @@ -50,7 +47,7 @@ impl AsyncTransaction for Pool { let mut transaction = conn.start_transaction(options).await?; let mut count = 0; for query in queries { - transaction.query_drop(query).await?; + transaction.query_drop(*query).await?; count += 1; } transaction.commit().await?; diff --git a/refinery_core/src/drivers/postgres.rs b/refinery_core/src/drivers/postgres.rs index fa4d5b9e..3d177509 100644 --- a/refinery_core/src/drivers/postgres.rs +++ b/refinery_core/src/drivers/postgres.rs @@ -33,13 +33,10 @@ fn query_applied_migrations( impl Transaction for PgClient { type Error = PgError; - fn execute<'a, T: Iterator>( - &mut self, - queries: T, - ) -> Result { + fn execute(&mut self, queries: &[&str]) -> Result { let mut transaction = PgClient::transaction(self)?; let mut count = 0; - for query in queries { + for query in queries.iter() { PgTransaction::batch_execute(&mut transaction, query)?; count += 1; } diff --git a/refinery_core/src/drivers/rusqlite.rs b/refinery_core/src/drivers/rusqlite.rs index 9ee4ced9..9547ba48 100644 --- a/refinery_core/src/drivers/rusqlite.rs +++ b/refinery_core/src/drivers/rusqlite.rs @@ -32,13 +32,10 @@ fn query_applied_migrations( impl Transaction for RqlConnection { type Error = RqlError; - fn execute<'a, T: Iterator>( - &mut self, - queries: T, - ) -> Result { + fn execute(&mut self, queries: &[&str]) -> Result { let transaction = self.transaction()?; let mut count = 0; - for query in queries { + for query in queries.iter() { transaction.execute_batch(query)?; count += 1; } diff --git a/refinery_core/src/drivers/tiberius.rs b/refinery_core/src/drivers/tiberius.rs index 8cab422a..117c6344 100644 --- a/refinery_core/src/drivers/tiberius.rs +++ b/refinery_core/src/drivers/tiberius.rs @@ -46,16 +46,13 @@ where { type Error = Error; - async fn execute<'a, T: Iterator + Send>( - &mut self, - queries: T, - ) -> Result { + async fn execute(&mut self, queries: &[&str]) -> Result { // Tiberius doesn't support transactions, see https://github.com/prisma/tiberius/issues/28 self.simple_query("BEGIN TRAN T1;").await?; let mut count = 0; for query in queries { // Drop the returning `QueryStream<'a>` to avoid compiler complaning regarding lifetimes - if let Err(err) = self.simple_query(query).await.map(drop) { + if let Err(err) = self.simple_query(*query).await.map(drop) { if let Err(err) = self.simple_query("ROLLBACK TRAN T1").await { log::error!("could not ROLLBACK transaction, {}", err); } diff --git a/refinery_core/src/drivers/tokio_postgres.rs b/refinery_core/src/drivers/tokio_postgres.rs index 346cfd7c..ec8bb9c8 100644 --- a/refinery_core/src/drivers/tokio_postgres.rs +++ b/refinery_core/src/drivers/tokio_postgres.rs @@ -35,10 +35,7 @@ async fn query_applied_migrations( impl AsyncTransaction for Client { type Error = PgError; - async fn execute<'a, T: Iterator + Send>( - &mut self, - queries: T, - ) -> Result { + async fn execute(&mut self, queries: &[&str]) -> Result { let transaction = self.transaction().await?; let mut count = 0; for query in queries { diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index 8831041f..fc9e4f75 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -12,10 +12,7 @@ use std::string::ToString; pub trait AsyncTransaction { type Error: std::error::Error + Send + Sync + 'static; - async fn execute<'a, T: Iterator + Send>( - &mut self, - queries: T, - ) -> Result; + async fn execute(&mut self, query: &[&str]) -> Result; } #[async_trait] @@ -46,13 +43,10 @@ async fn migrate( migration.set_applied(); let update_query = insert_migration_query(&migration, migration_table_name); transaction - .execute( - [ - migration.sql().as_ref().expect("sql must be Some!"), - update_query.as_str(), - ] - .into_iter(), - ) + .execute(&[ + migration.sql().as_ref().expect("sql must be Some!"), + &update_query, + ]) .await .migration_err( &format!("error applying migration {}", migration), @@ -111,10 +105,10 @@ async fn migrate_grouped( ); } - let refs = grouped_migrations.iter().map(AsRef::as_ref); + let refs: Vec<&str> = grouped_migrations.iter().map(AsRef::as_ref).collect(); transaction - .execute(refs) + .execute(refs.as_ref()) .await .migration_err("error applying migrations", None)?; @@ -172,11 +166,9 @@ where target: Target, migration_table_name: &str, ) -> Result { - self.execute( - [Self::assert_migrations_table_query(migration_table_name).as_str()].into_iter(), - ) - .await - .migration_err("error asserting migrations table", None)?; + self.execute(&[&Self::assert_migrations_table_query(migration_table_name)]) + .await + .migration_err("error asserting migrations table", None)?; let applied_migrations = self .get_applied_migrations(migration_table_name) diff --git a/refinery_core/src/traits/sync.rs b/refinery_core/src/traits/sync.rs index bf761035..23cc7a90 100644 --- a/refinery_core/src/traits/sync.rs +++ b/refinery_core/src/traits/sync.rs @@ -1,5 +1,3 @@ -use std::ops::Deref; - use crate::error::WrapMigrationError; use crate::traits::{ insert_migration_query, verify_migrations, ASSERT_MIGRATIONS_TABLE_QUERY, @@ -10,10 +8,7 @@ use crate::{Error, Migration, Report, Target}; pub trait Transaction { type Error: std::error::Error + Send + Sync + 'static; - fn execute<'a, T: Iterator>( - &mut self, - queries: T, - ) -> Result; + fn execute(&mut self, queries: &[&str]) -> Result; } pub trait Query: Transaction { @@ -25,7 +20,7 @@ pub fn migrate( migrations: Vec, target: Target, migration_table_name: &str, - grouped: bool, + batched: bool, ) -> Result { let mut migration_batch = Vec::new(); let mut applied_migrations = Vec::new(); @@ -54,7 +49,7 @@ pub fn migrate( migration_batch.push(insert_migration); } - match (target, grouped) { + match (target, batched) { (Target::Fake | Target::FakeVersion(_), _) => { log::info!("not going to apply any migration as fake flag is enabled"); } @@ -73,14 +68,16 @@ pub fn migrate( } }; - if grouped { + let refs: Vec<&str> = migration_batch.iter().map(AsRef::as_ref).collect(); + + if batched { transaction - .execute(migration_batch.iter().map(Deref::deref)) + .execute(refs.as_ref()) .migration_err("error applying migrations", None)?; } else { - for (i, update) in migration_batch.into_iter().enumerate() { + for (i, update) in refs.iter().enumerate() { transaction - .execute([update.as_str()].into_iter()) + .execute(&[update]) .migration_err("error applying update", Some(&applied_migrations[0..i / 2]))?; } } @@ -108,10 +105,8 @@ where fn assert_migrations_table(&mut self, migration_table_name: &str) -> Result { // Needed cause some database vendors like Mssql have a non sql standard way of checking the migrations table, // thou on this case it's just to be consistent with the async trait `AsyncMigrate` - self.execute( - [Self::assert_migrations_table_query(migration_table_name).as_str()].into_iter(), - ) - .migration_err("error asserting migrations table", None) + self.execute(&[Self::assert_migrations_table_query(migration_table_name).as_str()]) + .migration_err("error asserting migrations table", None) } fn get_last_applied_migration( From a57ebb922aca1bfdbd011c63c404bb943ea9ea73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 21 Feb 2025 14:23:16 +0000 Subject: [PATCH 31/64] prepare 0.8.16 (#371) --- CHANGELOG.md | 6 +++++- refinery/Cargo.toml | 6 +++--- refinery_cli/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 2 +- refinery_macros/Cargo.toml | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eb2603d..254618a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.8.15] - 2024-02-18 +## [0.8.16] - 2024-02-21 +### Fixed +- Revert [#346](https://github.com/rust-db/refinery/pull/346) as it breaks Semver, save it for a minor release in the future. + +## [0.8.15] - **YANKED** - 2024-02-18 ### Added - Make a query overridable. [#358](https://github.com/rust-db/refinery/pull/358) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index dd51d5d3..f2211002 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery" -version = "0.8.15" +version = "0.8.16" rust-version = "1.75" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" @@ -27,8 +27,8 @@ toml = ["refinery-core/toml"] enums = ["refinery-macros/enums"] [dependencies] -refinery-core = { version = "0.8.15", path = "../refinery_core" } -refinery-macros = { version = "0.8.15", path = "../refinery_macros" } +refinery-core = { version = "0.8.16", path = "../refinery_core" } +refinery-macros = { version = "0.8.16", path = "../refinery_macros" } [dev-dependencies] barrel = { git = "https://github.com/jxs/barrel", features = ["sqlite3", "pg", "mysql", "mssql"] } diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index 4da48f81..f81101c2 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery_cli" -version = "0.8.15" +version = "0.8.16" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT OR Apache-2.0" description = "Provides the CLI for the Refinery crate" @@ -23,7 +23,7 @@ sqlite-bundled = ["sqlite", "refinery-core/rusqlite-bundled"] mssql = ["refinery-core/tiberius-config", "tokio"] [dependencies] -refinery-core = { version = "0.8.15", path = "../refinery_core", default-features = false, features = ["toml"] } +refinery-core = { version = "0.8.16", path = "../refinery_core", default-features = false, features = ["toml"] } clap = { version = "4", features = ["derive"] } human-panic = "2" toml = "0.8" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 7e40557a..86ff7898 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-core" -version = "0.8.15" +version = "0.8.16" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 087619d3..53ea21e2 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-macros" -version = "0.8.15" +version = "0.8.16" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" @@ -15,7 +15,7 @@ enums = [] proc-macro = true [dependencies] -refinery-core = { version = "0.8.15", path = "../refinery_core" } +refinery-core = { version = "0.8.16", path = "../refinery_core" } quote = "1" syn = "2" proc-macro2 = "1" From ed1fbcfc8c8b9b115e0e0b353a9b32faa4deb4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Fri, 14 Mar 2025 21:11:37 +0000 Subject: [PATCH 32/64] thiserror 2 (#372) --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 86ff7898..cf02c9b4 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -24,7 +24,7 @@ cfg-if = "1.0" log = "0.4" regex = "1" siphasher = "1.0" -thiserror = "1" +thiserror = "2" url = "2.0" walkdir = "2.3.1" From 1dba8efe96b09cb9ce8e945f23ca986c4ffef654 Mon Sep 17 00:00:00 2001 From: Jonas_Focke Date: Sun, 16 Mar 2025 01:22:02 +0100 Subject: [PATCH 33/64] Add implementation note to readme (#376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Oliveira --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 16ef4042..105cf2ac 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ This would stop developer 1's migration from ever running if you were using cont refinery works by creating a table that keeps all the applied migrations' versions and their metadata. When you [run](https://docs.rs/refinery/latest/refinery/struct.Runner.html#method.run) the migrations `Runner`, refinery compares the applied migrations with the ones to be applied, checking for [divergent](https://docs.rs/refinery/latest/refinery/struct.Runner.html#method.set_abort_divergent) and [missing](https://docs.rs/refinery/latest/refinery/struct.Runner.html#method.set_abort_missing) and executing unapplied migrations.\ By default, refinery runs each migration in a single transaction. Alternatively, you can also configure refinery to wrap the entire execution of all migrations in a single transaction by setting [set_grouped](https://docs.rs/refinery/latest/refinery/struct.Runner.html#method.set_grouped) to true. +The rust crate intentionally ignores new migration files until your sourcecode is rebuild. This prevents accidental migrations and altering the database schema without any code changes. We can also bake the migrations into the binary, so no additional files are needed when deployed. ### Rollback From 2187a0358f1f4d8f59828bbba3320328ad6d91ad Mon Sep 17 00:00:00 2001 From: Josh Holbrook Date: Thu, 10 Apr 2025 00:21:16 -0800 Subject: [PATCH 34/64] Support rusqlite 0.34.x (#377) --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index cf02c9b4..6e31b5ef 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -29,7 +29,7 @@ url = "2.0" walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar -rusqlite = { version = ">= 0.23, <= 0.33", optional = true } +rusqlite = { version = ">= 0.23, <= 0.34", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 26", optional = true, default-features = false, features = ["minimal"] } From c5cd69e756a7b3627250d2f959b500831e555831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Sat, 12 Apr 2025 14:49:52 +0100 Subject: [PATCH 35/64] Update msrv (#362) * update msrv * Update refinery/Cargo.toml --- refinery/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index f2211002..fe4047f2 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "refinery" version = "0.8.16" -rust-version = "1.75" +rust-version = "1.83" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" description = "Powerful SQL migration toolkit for Rust" From 3fa178fc2da8d29a897886b95d05435302811f6c Mon Sep 17 00:00:00 2001 From: Kristopher Wuollett Date: Sat, 3 May 2025 00:16:09 +0800 Subject: [PATCH 36/64] Support rusqlite 0.35.x (#380) (#381) --- examples/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 2a9d6037..f999299e 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -13,7 +13,7 @@ enums = ["refinery/enums"] [dependencies] refinery = { path = "../refinery", features = ["rusqlite"] } -rusqlite = "0.31" +rusqlite = "0.35" barrel = { version = "0.7", features = ["sqlite3"] } log = "0.4" -env_logger = "0.11" \ No newline at end of file +env_logger = "0.11" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 6e31b5ef..6763bb22 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -29,7 +29,7 @@ url = "2.0" walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar -rusqlite = { version = ">= 0.23, <= 0.34", optional = true } +rusqlite = { version = ">= 0.23, <= 0.35", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 26", optional = true, default-features = false, features = ["minimal"] } From 12e58d008f9dead0891812c86f802a7aa8382e4e Mon Sep 17 00:00:00 2001 From: Kristopher Wuollett Date: Mon, 21 Jul 2025 04:07:20 +0800 Subject: [PATCH 37/64] Support rusqlite 0.37.x (#389) (#390) --- examples/Cargo.toml | 2 +- refinery_core/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index f999299e..e5874a25 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -13,7 +13,7 @@ enums = ["refinery/enums"] [dependencies] refinery = { path = "../refinery", features = ["rusqlite"] } -rusqlite = "0.35" +rusqlite = "0.37" barrel = { version = "0.7", features = ["sqlite3"] } log = "0.4" env_logger = "0.11" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 6763bb22..4c3cb3fc 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -29,7 +29,7 @@ url = "2.0" walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar -rusqlite = { version = ">= 0.23, <= 0.35", optional = true } +rusqlite = { version = ">= 0.23, <= 0.37", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 26", optional = true, default-features = false, features = ["minimal"] } From 057ef7470f464d7832eb6fff2dc773229b4c0f24 Mon Sep 17 00:00:00 2001 From: Bent Engbers Date: Mon, 21 Jul 2025 01:38:16 +0200 Subject: [PATCH 38/64] fix logging output for async and sync migrate functions (#378) --- refinery_core/src/traits/async.rs | 8 ++++++-- refinery_core/src/traits/sync.rs | 26 ++++++++++++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index fc9e4f75..d7fae366 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -91,9 +91,13 @@ async fn migrate_grouped( log::info!("not going to apply any migration as fake flag is enabled"); } Target::Latest | Target::Version(_) => { + let migrations_display = applied_migrations + .iter() + .map(ToString::to_string) + .collect::>() + .join("\n"); log::info!( - "going to apply batch migrations in single transaction: {:#?}", - applied_migrations.iter().map(ToString::to_string) + "going to apply batch migrations in single transaction:\n{migrations_display}" ); } }; diff --git a/refinery_core/src/traits/sync.rs b/refinery_core/src/traits/sync.rs index 23cc7a90..e138e3c5 100644 --- a/refinery_core/src/traits/sync.rs +++ b/refinery_core/src/traits/sync.rs @@ -36,7 +36,6 @@ pub fn migrate( } } - log::info!("applying migration: {}", migration); migration.set_applied(); let insert_migration = insert_migration_query(&migration, migration_table_name); let migration_sql = migration.sql().expect("sql must be Some!").to_string(); @@ -51,19 +50,18 @@ pub fn migrate( match (target, batched) { (Target::Fake | Target::FakeVersion(_), _) => { - log::info!("not going to apply any migration as fake flag is enabled"); + log::info!("not going to apply any migration as fake flag is enabled."); } (Target::Latest | Target::Version(_), true) => { log::info!( - "going to apply batch migrations in single transaction: {:#?}", - applied_migrations.iter().map(ToString::to_string) + "going to batch apply {} migrations in single transaction.", + applied_migrations.len() ); } (Target::Latest | Target::Version(_), false) => { log::info!( - "preparing to apply {} migrations: {:#?}", + "going to apply {} migrations in multiple transactions.", applied_migrations.len(), - applied_migrations.iter().map(ToString::to_string) ); } }; @@ -71,11 +69,27 @@ pub fn migrate( let refs: Vec<&str> = migration_batch.iter().map(AsRef::as_ref).collect(); if batched { + let migrations_display = applied_migrations + .iter() + .map(ToString::to_string) + .collect::>() + .join("\n"); + log::info!("going to apply batch migrations in single transaction:\n{migrations_display}"); transaction .execute(refs.as_ref()) .migration_err("error applying migrations", None)?; } else { for (i, update) in refs.iter().enumerate() { + // first iteration is pair so we know the following even in the iteration index + // marks the previous (pair) migration as completed. + let applying_migration = i % 2 == 0; + let current_migration = &applied_migrations[i / 2]; + if applying_migration { + log::info!("applying migration: {current_migration} ..."); + } else { + // Writing the migration state to the db. + log::debug!("applied migration: {current_migration} writing state to db."); + } transaction .execute(&[update]) .migration_err("error applying update", Some(&applied_migrations[0..i / 2]))?; From 967f98e71f3e0fffba6f7ca326151587a480f005 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 25 Jul 2025 15:05:53 +0200 Subject: [PATCH 39/64] Add support for TLS in postgres/tokio-postgres using native-tls (#353) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for using TLS with PostgreSQL (#260) * Make use_tls optional in config * Include openssl crates in refinery module * tls support for postgres using native-tls * use tls for tokio_postgres as well * nit * nit * fix issues * avoid touching main Cargo.toml * add new tests * fix serde bug --------- Co-authored-by: moss Co-authored-by: João Oliveira --- refinery/tests/postgres.rs | 35 +++++++++++ refinery/tests/tokio_postgres.rs | 34 +++++++++++ refinery_core/Cargo.toml | 9 ++- refinery_core/src/config.rs | 95 +++++++++++++++++++++++++++-- refinery_core/src/drivers/config.rs | 37 ++++++++--- 5 files changed, 193 insertions(+), 17 deletions(-) diff --git a/refinery/tests/postgres.rs b/refinery/tests/postgres.rs index ec10a2c8..f4f6e362 100644 --- a/refinery/tests/postgres.rs +++ b/refinery/tests/postgres.rs @@ -4,6 +4,7 @@ use barrel::backend::Pg as Sql; mod postgres { use assert_cmd::prelude::*; use predicates::str::contains; + use refinery::config::ConfigDbType; use refinery::{ config::Config, embed_migrations, error::Kind, Migrate, Migration, Runner, Target, }; @@ -728,4 +729,38 @@ mod postgres { .stdout(contains("applying migration: V3__add_brand_to_cars_table")); }) } + + #[test] + fn migrates_with_tls_enabled() { + run_test(|| { + let mut config = Config::new(ConfigDbType::Postgres) + .set_db_name("postgres") + .set_db_user("postgres") + .set_db_host("localhost") + .set_db_port("5432") + .set_use_tls(true); + + let migrations = get_migrations(); + let runner = Runner::new(&migrations) + .set_grouped(false) + .set_abort_divergent(true) + .set_abort_missing(true); + + let report = runner.run(&mut config).unwrap(); + + let applied_migrations = report.applied_migrations(); + assert_eq!(5, applied_migrations.len()); + + let last_migration = runner + .get_last_applied_migration(&mut config) + .unwrap() + .unwrap(); + + assert_eq!(5, last_migration.version()); + assert_eq!(migrations[4].name(), last_migration.name()); + assert_eq!(migrations[4].checksum(), last_migration.checksum()); + + assert!(config.use_tls()); + }); + } } diff --git a/refinery/tests/tokio_postgres.rs b/refinery/tests/tokio_postgres.rs index 2f7f7fc6..e086eccd 100644 --- a/refinery/tests/tokio_postgres.rs +++ b/refinery/tests/tokio_postgres.rs @@ -12,6 +12,7 @@ mod tokio_postgres { use refinery_core::tokio_postgres; use refinery_core::tokio_postgres::NoTls; use std::panic::AssertUnwindSafe; + use std::str::FromStr; use time::OffsetDateTime; const DEFAULT_TABLE_NAME: &str = "refinery_schema_history"; @@ -953,4 +954,37 @@ mod tokio_postgres { }) .await; } + + #[tokio::test] + async fn migrates_with_tls_enabled() { + run_test(async { + let mut config = + Config::from_str("postgres://postgres@localhost:5432/postgres?sslmode=require") + .unwrap(); + + let migrations = get_migrations(); + let runner = Runner::new(&migrations) + .set_grouped(false) + .set_abort_divergent(true) + .set_abort_missing(true); + + let report = runner.run_async(&mut config).await.unwrap(); + + let applied_migrations = report.applied_migrations(); + assert_eq!(5, applied_migrations.len()); + + let last_migration = runner + .get_last_applied_migration_async(&mut config) + .await + .unwrap() + .unwrap(); + + assert_eq!(5, last_migration.version()); + assert_eq!(migrations[4].name(), last_migration.name()); + assert_eq!(migrations[4].checksum(), last_migration.checksum()); + + assert!(config.use_tls()); + }) + .await; + } } diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 4c3cb3fc..387fc106 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -10,12 +10,13 @@ edition = "2021" [features] default = [] +mysql_async = ["dep:mysql_async"] +postgres = ["dep:postgres", "dep:postgres-native-tls", "dep:native-tls"] rusqlite-bundled = ["rusqlite", "rusqlite/bundled"] +serde = ["dep:serde"] tiberius = ["dep:tiberius", "futures", "tokio", "tokio/net"] tiberius-config = ["tiberius", "tokio", "tokio-util", "serde"] -tokio-postgres = ["dep:tokio-postgres", "tokio", "tokio/rt"] -mysql_async = ["dep:mysql_async"] -serde = ["dep:serde"] +tokio-postgres = ["dep:postgres-native-tls", "dep:native-tls", "dep:tokio-postgres", "tokio", "tokio/rt"] toml = ["serde", "dep:toml"] [dependencies] @@ -31,6 +32,8 @@ walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar rusqlite = { version = ">= 0.23, <= 0.37", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } +native-tls = { version = "0.2", optional = true } +postgres-native-tls = { version = "0.5", optional = true} tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 26", optional = true, default-features = false, features = ["minimal"] } mysql_async = { version = ">= 0.28, <= 0.35", optional = true, default-features = false, features = ["minimal"] } diff --git a/refinery_core/src/config.rs b/refinery_core/src/config.rs index 7eba833f..0d6319ad 100644 --- a/refinery_core/src/config.rs +++ b/refinery_core/src/config.rs @@ -3,6 +3,12 @@ use crate::Error; use std::convert::TryFrom; use std::path::PathBuf; use std::str::FromStr; +#[cfg(any( + feature = "postgres", + feature = "tokio-postgres", + feature = "tiberius-config" +))] +use std::{borrow::Cow, collections::HashMap}; use url::Url; // refinery config file used by migrate_from_config if migration from a Config struct is preferred instead of using the macros @@ -34,6 +40,8 @@ impl Config { db_user: None, db_pass: None, db_name: None, + #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] + use_tls: false, #[cfg(feature = "tiberius-config")] trust_cert: false, }, @@ -139,6 +147,11 @@ impl Config { self.main.db_port.as_deref() } + #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] + pub fn use_tls(&self) -> bool { + self.main.use_tls + } + pub fn set_db_user(self, db_user: &str) -> Config { Config { main: Main { @@ -183,6 +196,16 @@ impl Config { }, } } + + #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] + pub fn set_use_tls(self, use_tls: bool) -> Config { + Config { + main: Main { + use_tls, + ..self.main + }, + } + } } impl TryFrom for Config { @@ -203,13 +226,17 @@ impl TryFrom for Config { } }; + #[cfg(any( + feature = "postgres", + feature = "tokio-postgres", + feature = "tiberius-config" + ))] + let query_params = url + .query_pairs() + .collect::, Cow<'_, str>>>(); + cfg_if::cfg_if! { if #[cfg(feature = "tiberius-config")] { - use std::{borrow::Cow, collections::HashMap}; - let query_params = url - .query_pairs() - .collect::, Cow<'_, str>>>(); - let trust_cert = query_params. get("trust_cert") .unwrap_or(&Cow::Borrowed("false")) @@ -223,6 +250,18 @@ impl TryFrom for Config { } } + #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] + let use_tls = match query_params.get("sslmode") { + Some(Cow::Borrowed("require")) => true, + Some(Cow::Borrowed("disable")) | None => false, + _ => { + return Err(Error::new( + Kind::ConfigError("Invalid sslmode value, please use disable/require".into()), + None, + )) + } + }; + Ok(Self { main: Main { db_type, @@ -238,6 +277,8 @@ impl TryFrom for Config { db_user: Some(url.username().to_string()), db_pass: url.password().map(|r| r.to_string()), db_name: Some(url.path().trim_start_matches('/').to_string()), + #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] + use_tls, #[cfg(feature = "tiberius-config")] trust_cert, }, @@ -270,8 +311,11 @@ struct Main { db_user: Option, db_pass: Option, db_name: Option, + #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] + #[cfg_attr(feature = "serde", serde(default))] + use_tls: bool, #[cfg(feature = "tiberius-config")] - #[serde(default)] + #[cfg_attr(feature = "serde", serde(default))] trust_cert: bool, } @@ -453,6 +497,45 @@ mod tests { ); } + #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] + #[test] + fn builds_from_sslmode_str() { + use crate::config::ConfigDbType; + + let config_disable = + Config::from_str("postgres://root:1234@localhost:5432/refinery?sslmode=disable") + .unwrap(); + assert!(!config_disable.use_tls()); + + let config_require = + Config::from_str("postgres://root:1234@localhost:5432/refinery?sslmode=require") + .unwrap(); + assert!(config_require.use_tls()); + + // Verify that manually created config matches parsed URL config + let manual_config_disable = Config::new(ConfigDbType::Postgres) + .set_db_user("root") + .set_db_pass("1234") + .set_db_host("localhost") + .set_db_port("5432") + .set_db_name("refinery") + .set_use_tls(false); + assert_eq!(config_disable.use_tls(), manual_config_disable.use_tls()); + + let manual_config_require = Config::new(ConfigDbType::Postgres) + .set_db_user("root") + .set_db_pass("1234") + .set_db_host("localhost") + .set_db_port("5432") + .set_db_name("refinery") + .set_use_tls(true); + assert_eq!(config_require.use_tls(), manual_config_require.use_tls()); + + let config = + Config::from_str("postgres://root:1234@localhost:5432/refinery?sslmode=invalidvalue"); + assert!(config.is_err()); + } + #[test] fn builds_db_env_var_failure() { std::env::set_var("DATABASE_URL", "this_is_not_a_url"); diff --git a/refinery_core/src/drivers/config.rs b/refinery_core/src/drivers/config.rs index 639ff108..c7539028 100644 --- a/refinery_core/src/drivers/config.rs +++ b/refinery_core/src/drivers/config.rs @@ -82,7 +82,16 @@ macro_rules! with_connection { cfg_if::cfg_if! { if #[cfg(feature = "postgres")] { let path = build_db_url("postgresql", &$config); - let conn = postgres::Client::connect(path.as_str(), postgres::NoTls).migration_err("could not connect to database", None)?; + + let conn; + if $config.use_tls() { + let connector = native_tls::TlsConnector::new().unwrap(); + let connector = postgres_native_tls::MakeTlsConnector::new(connector); + conn = postgres::Client::connect(path.as_str(), connector).migration_err("could not connect to database", None)?; + } else { + conn = postgres::Client::connect(path.as_str(), postgres::NoTls).migration_err("could not connect to database", None)?; + } + $op(conn) } else { panic!("tried to migrate from config for a postgresql database, but feature postgres not enabled!"); @@ -123,13 +132,25 @@ macro_rules! with_connection_async { cfg_if::cfg_if! { if #[cfg(feature = "tokio-postgres")] { let path = build_db_url("postgresql", $config); - let (client, connection ) = tokio_postgres::connect(path.as_str(), tokio_postgres::NoTls).await.migration_err("could not connect to database", None)?; - tokio::spawn(async move { - if let Err(e) = connection.await { - eprintln!("connection error: {}", e); - } - }); - $op(client).await + if $config.use_tls() { + let connector = native_tls::TlsConnector::new().unwrap(); + let connector = postgres_native_tls::MakeTlsConnector::new(connector); + let (client, connection) = tokio_postgres::connect(path.as_str(), connector).await.migration_err("could not connect to database", None)?; + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + $op(client).await + } else { + let (client, connection) = tokio_postgres::connect(path.as_str(), tokio_postgres::NoTls).await.migration_err("could not connect to database", None)?; + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + $op(client).await + } } else { panic!("tried to migrate async from config for a postgresql database, but tokio-postgres was not enabled!"); } From bec7d222cc0de1aac0a025afdcaef33dfa23e5d8 Mon Sep 17 00:00:00 2001 From: Matt Palmer Date: Sat, 26 Jul 2025 00:49:27 +1000 Subject: [PATCH 40/64] Support int8 migration versions via new int8-versions feature (#330) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Support int8 migration versions via new int8-versions feature This addresses, though does not really *fix* #83, because it doesn't make refinery support timestamped migrations *by default*, but only if you opt-in to the new feature. However, making it an optional feature neatly sidesteps the unanswered questions in the issue, and so makes the implementation easier to complete and land. * cargo clippy * update wording * remove repr * fix enum migrations * enable int8-versions test * fix PR --------- Co-authored-by: João Oliveira --- .github/workflows/ci.yml | 3 +- README.md | 14 ++- examples/Cargo.toml | 1 + refinery/Cargo.toml | 1 + refinery/src/lib.rs | 4 +- .../U20240504090241__initial.rs | 15 +++ ...240504090301__add_cars_and_motos_table.sql | 8 ++ ...0240504090322__add_brand_to_cars_table.sql | 2 + ...20240504090343__add_year_to_motos_table.rs | 13 +++ refinery/tests/postgres.rs | 44 ++++++++ refinery_cli/Cargo.toml | 1 + refinery_cli/src/cli.rs | 4 +- refinery_cli/src/migrate.rs | 4 +- refinery_core/Cargo.toml | 1 + refinery_core/src/drivers/mysql_async.rs | 3 +- refinery_core/src/drivers/tiberius.rs | 3 +- refinery_core/src/lib.rs | 2 +- refinery_core/src/runner.rs | 14 +-- refinery_core/src/traits/async.rs | 2 +- refinery_core/src/traits/mod.rs | 22 +++- refinery_core/src/traits/sync.rs | 4 +- refinery_core/src/util.rs | 9 +- refinery_macros/Cargo.toml | 5 +- refinery_macros/src/lib.rs | 106 ++++++++++++------ 24 files changed, 221 insertions(+), 64 deletions(-) create mode 100644 refinery/tests/migrations_int8/U20240504090241__initial.rs create mode 100644 refinery/tests/migrations_int8/U20240504090301__add_cars_and_motos_table.sql create mode 100644 refinery/tests/migrations_int8/U20240504090322__add_brand_to_cars_table.sql create mode 100644 refinery/tests/migrations_int8/U20240504090343__add_year_to_motos_table.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 138651d0..33961942 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: - run: rustup self update - run: cd refinery_core && cargo test --all-features -- --test-threads 1 - run: cd refinery && cargo build --all-features - - run: cd refinery_macros && cargo test --features=enums + - run: cd refinery_macros && cargo test --all-features - run: cd refinery_cli && cargo test test-sqlite: @@ -98,6 +98,7 @@ jobs: toolchain: ${{ matrix.rust }} - run: cargo install --path ./refinery_cli --no-default-features --features=postgresql - run: cd refinery && cargo test --features postgres --test postgres -- --test-threads 1 + - run: cd refinery && cargo test --features postgres,int8-versions --test postgres -- --test-threads 1 test-tokio-postgres: name: Test tokio-postgres diff --git a/README.md b/README.md index 105cf2ac..12cd571e 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,13 @@ If you are using a driver that is not yet supported, namely [`SQLx`](https://git - Migrations, both .sql files and Rust modules must be named in the format `[U|V]{1}__{2}.sql` or `[U|V]{1}__{2}.rs`, where `{1}` represents the migration version and `{2}` the name. - Migrations can be run either by embedding them in your Rust code with `embed_migrations` macro, or via [refinery_cli]. +NOTE: + +- By default, migration version numbers are restricted to `i32` (signed, 32-bit integers). +- If you enable the `int8-versions` feature, this restriction is lifted to being able to use `i64`s for your migration version numbers. + Bear in mind that this feature must be enabled *before* you start using refinery on a given database. + Migrating an existing database's `refinery_schema_history` table to use `int8` versions **will break the checksums on all previously-applied migrations**. + ### Example: Library ```rust,no_run use rusqlite::Connection; @@ -53,15 +60,10 @@ fn main() { For more library examples, refer to the [`examples`](https://github.com/rust-db/refinery/tree/main/examples). ### Example: CLI -NOTE: - -- Contiguous (adjacent) migration version numbers are restricted to `u32` (unsigned, 32-bit integers). -- Non-contiguous (not adjacent) migration version numbers are restricted to `u32` (unsigned, 32-bit integers). - ```bash export DATABASE_URL="postgres://postgres:secret@localhost:5432/your-db" pushd migrations - # Runs ./src/V1__*.rs or ./src/V1__*.sql + # Runs ./src/V1__*.rs or ./src/V1__*.sql refinery migrate -e DATABASE_URL -p ./src -t 1 popd ``` diff --git a/examples/Cargo.toml b/examples/Cargo.toml index e5874a25..69635967 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [features] enums = ["refinery/enums"] +int8-versions = ["refinery/int8-versions"] [dependencies] refinery = { path = "../refinery", features = ["rusqlite"] } diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index fe4047f2..ef1ab995 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -25,6 +25,7 @@ tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config"] serde = ["refinery-core/serde"] toml = ["refinery-core/toml"] enums = ["refinery-macros/enums"] +int8-versions = ["refinery-core/int8-versions", "refinery-macros/int8-versions"] [dependencies] refinery-core = { version = "0.8.16", path = "../refinery_core" } diff --git a/refinery/src/lib.rs b/refinery/src/lib.rs index 93cfaac5..945303cc 100644 --- a/refinery/src/lib.rs +++ b/refinery/src/lib.rs @@ -32,7 +32,9 @@ for more examples refer to the [examples](https://github.com/rust-db/refinery/tr */ pub use refinery_core::config; -pub use refinery_core::{error, load_sql_migrations, Error, Migration, Report, Runner, Target}; +pub use refinery_core::{ + error, load_sql_migrations, Error, Migration, Report, Runner, SchemaVersion, Target, +}; #[doc(hidden)] pub use refinery_core::{AsyncMigrate, Migrate}; pub use refinery_macros::embed_migrations; diff --git a/refinery/tests/migrations_int8/U20240504090241__initial.rs b/refinery/tests/migrations_int8/U20240504090241__initial.rs new file mode 100644 index 00000000..3a84e506 --- /dev/null +++ b/refinery/tests/migrations_int8/U20240504090241__initial.rs @@ -0,0 +1,15 @@ +use barrel::{types, Migration}; + +use crate::Sql; + +pub fn migration() -> String { + let mut m = Migration::new(); + + m.create_table("persons", |t| { + t.add_column("id", types::primary()); + t.add_column("name", types::varchar(255)); + t.add_column("city", types::varchar(255)); + }); + + m.make::() +} diff --git a/refinery/tests/migrations_int8/U20240504090301__add_cars_and_motos_table.sql b/refinery/tests/migrations_int8/U20240504090301__add_cars_and_motos_table.sql new file mode 100644 index 00000000..13390796 --- /dev/null +++ b/refinery/tests/migrations_int8/U20240504090301__add_cars_and_motos_table.sql @@ -0,0 +1,8 @@ +CREATE TABLE cars ( + id int, + name varchar(255) +); +CREATE TABLE motos ( + id int, + name varchar(255) +); diff --git a/refinery/tests/migrations_int8/U20240504090322__add_brand_to_cars_table.sql b/refinery/tests/migrations_int8/U20240504090322__add_brand_to_cars_table.sql new file mode 100644 index 00000000..c689a6aa --- /dev/null +++ b/refinery/tests/migrations_int8/U20240504090322__add_brand_to_cars_table.sql @@ -0,0 +1,2 @@ +ALTER TABLE cars +ADD brand varchar(255); diff --git a/refinery/tests/migrations_int8/U20240504090343__add_year_to_motos_table.rs b/refinery/tests/migrations_int8/U20240504090343__add_year_to_motos_table.rs new file mode 100644 index 00000000..57623df9 --- /dev/null +++ b/refinery/tests/migrations_int8/U20240504090343__add_year_to_motos_table.rs @@ -0,0 +1,13 @@ +use barrel::{types, Migration}; + +use crate::Sql; + +pub fn migration() -> String { + let mut m = Migration::new(); + + m.change_table("motos", |t| { + t.add_column("brand", types::varchar(255).nullable(true)); + }); + + m.make::() +} diff --git a/refinery/tests/postgres.rs b/refinery/tests/postgres.rs index f4f6e362..c4aa6308 100644 --- a/refinery/tests/postgres.rs +++ b/refinery/tests/postgres.rs @@ -30,6 +30,12 @@ mod postgres { embed_migrations!("./tests/migrations_missing"); } + #[cfg(feature = "int8-versions")] + mod int8 { + use refinery::embed_migrations; + embed_migrations!("./tests/migrations_int8"); + } + fn db_uri() -> String { std::env::var("DB_URI").unwrap_or("postgres://postgres@localhost:5432/postgres".to_string()) } @@ -183,6 +189,37 @@ mod postgres { }); } + #[test] + #[cfg(feature = "int8-versions")] + fn applies_migration_int8() { + run_test(|| { + let mut client = Client::connect(&db_uri(), NoTls).unwrap(); + let report = int8::migrations::runner().run(&mut client).unwrap(); + + let applied_migrations = report.applied_migrations(); + + assert_eq!(4, applied_migrations.len()); + + assert_eq!(20240504090241, applied_migrations[0].version()); + assert_eq!(20240504090301, applied_migrations[1].version()); + assert_eq!(20240504090322, applied_migrations[2].version()); + assert_eq!(20240504090343, applied_migrations[3].version()); + + client + .execute( + "INSERT INTO persons (name, city) VALUES ($1, $2)", + &[&"John Legend", &"New York"], + ) + .unwrap(); + for row in &client.query("SELECT name, city FROM persons", &[]).unwrap() { + let name: String = row.get(0); + let city: String = row.get(1); + assert_eq!("John Legend", name); + assert_eq!("New York", city); + } + }); + } + #[test] fn applies_migration_grouped_transaction() { run_test(|| { @@ -282,8 +319,15 @@ mod postgres { assert_eq!("initial", migrations[0].name()); assert_eq!("add_cars_table", applied_migrations[1].name()); + #[cfg(not(feature = "int8-versions"))] assert_eq!(2959965718684201605, applied_migrations[0].checksum()); + #[cfg(feature = "int8-versions")] + assert_eq!(13938959368620441626, applied_migrations[0].checksum()); + + #[cfg(not(feature = "int8-versions"))] assert_eq!(8238603820526370208, applied_migrations[1].checksum()); + #[cfg(feature = "int8-versions")] + assert_eq!(5394706226941044339, applied_migrations[1].checksum()); }); } diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index f81101c2..6289ff48 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -21,6 +21,7 @@ mysql = ["refinery-core/mysql"] sqlite = ["refinery-core/rusqlite"] sqlite-bundled = ["sqlite", "refinery-core/rusqlite-bundled"] mssql = ["refinery-core/tiberius-config", "tokio"] +int8-versions = ["refinery-core/int8-versions"] [dependencies] refinery-core = { version = "0.8.16", path = "../refinery_core", default-features = false, features = ["toml"] } diff --git a/refinery_cli/src/cli.rs b/refinery_cli/src/cli.rs index 03d13593..e394b911 100644 --- a/refinery_cli/src/cli.rs +++ b/refinery_cli/src/cli.rs @@ -4,6 +4,8 @@ use std::path::PathBuf; use clap::{Args, Parser}; +use refinery_core::SchemaVersion; + #[derive(Parser)] #[clap(version)] pub enum Cli { @@ -38,7 +40,7 @@ pub struct MigrateArgs { /// Migrate to the specified target version #[clap(short)] - pub target: Option, + pub target: Option, /// Set migration table name #[clap(long, default_value = "refinery_schema_history")] diff --git a/refinery_cli/src/migrate.rs b/refinery_cli/src/migrate.rs index b61fa876..77deae02 100644 --- a/refinery_cli/src/migrate.rs +++ b/refinery_cli/src/migrate.rs @@ -3,7 +3,7 @@ use std::path::Path; use anyhow::Context; use refinery_core::{ config::{Config, ConfigDbType}, - find_migration_files, Migration, MigrationType, Runner, Target, + find_migration_files, Migration, MigrationType, Runner, SchemaVersion, Target, }; use crate::cli::MigrateArgs; @@ -30,7 +30,7 @@ fn run_migrations( divergent: bool, missing: bool, fake: bool, - target: Option, + target: Option, env_var_opt: Option<&str>, path: &Path, table_name: &str, diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 387fc106..026da02e 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -18,6 +18,7 @@ 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"] toml = ["serde", "dep:toml"] +int8-versions = [] [dependencies] async-trait = "0.1" diff --git a/refinery_core/src/drivers/mysql_async.rs b/refinery_core/src/drivers/mysql_async.rs index 101ab0ab..c92fcd86 100644 --- a/refinery_core/src/drivers/mysql_async.rs +++ b/refinery_core/src/drivers/mysql_async.rs @@ -1,4 +1,5 @@ use crate::traits::r#async::{AsyncMigrate, AsyncQuery, AsyncTransaction}; +use crate::util::SchemaVersion; use crate::Migration; use async_trait::async_trait; use mysql_async::{ @@ -16,7 +17,7 @@ async fn query_applied_migrations<'a>( let applied = result .into_iter() .map(|row| { - let (version, name, applied_on, checksum): (i32, String, String, String) = + let (version, name, applied_on, checksum): (SchemaVersion, String, String, String) = mysql_async::from_row(row); // Safe to call unwrap, as we stored it in RFC3339 format on the database diff --git a/refinery_core/src/drivers/tiberius.rs b/refinery_core/src/drivers/tiberius.rs index 117c6344..a30e0311 100644 --- a/refinery_core/src/drivers/tiberius.rs +++ b/refinery_core/src/drivers/tiberius.rs @@ -1,4 +1,5 @@ use crate::traits::r#async::{AsyncMigrate, AsyncQuery, AsyncTransaction}; +use crate::util::SchemaVersion; use crate::Migration; use async_trait::async_trait; @@ -19,7 +20,7 @@ async fn query_applied_migrations( // Unfortunately too many unwraps as `Row::get` maps to Option instead of T while let Some(item) = rows.try_next().await? { if let QueryItem::Row(row) = item { - let version = row.get::(0).unwrap(); + let version = row.get::(0).unwrap(); let applied_on: &str = row.get::<&str, usize>(2).unwrap(); // Safe to call unwrap, as we stored it in RFC3339 format on the database let applied_on = OffsetDateTime::parse(applied_on, &Rfc3339).unwrap(); diff --git a/refinery_core/src/lib.rs b/refinery_core/src/lib.rs index b4d85b77..2d20865a 100644 --- a/refinery_core/src/lib.rs +++ b/refinery_core/src/lib.rs @@ -10,7 +10,7 @@ pub use crate::runner::{Migration, Report, Runner, Target}; pub use crate::traits::r#async::AsyncMigrate; pub use crate::traits::sync::Migrate; pub use crate::util::{ - find_migration_files, load_sql_migrations, parse_migration_name, MigrationType, + find_migration_files, load_sql_migrations, parse_migration_name, MigrationType, SchemaVersion, }; #[cfg(feature = "rusqlite")] diff --git a/refinery_core/src/runner.rs b/refinery_core/src/runner.rs index af8e2ab5..d6d93afb 100644 --- a/refinery_core/src/runner.rs +++ b/refinery_core/src/runner.rs @@ -8,7 +8,7 @@ use std::fmt; use std::hash::{Hash, Hasher}; use crate::traits::{sync::migrate as sync_migrate, DEFAULT_MIGRATION_TABLE_NAME}; -use crate::util::parse_migration_name; +use crate::util::{parse_migration_name, SchemaVersion}; use crate::{AsyncMigrate, Error, Migrate}; use std::fmt::Formatter; @@ -43,9 +43,9 @@ impl fmt::Debug for Type { #[derive(Clone, Copy, Debug)] pub enum Target { Latest, - Version(u32), + Version(SchemaVersion), Fake, - FakeVersion(u32), + FakeVersion(SchemaVersion), } // an Enum set that represents the state of the migration: Applied on the database, @@ -66,7 +66,7 @@ pub struct Migration { state: State, name: String, checksum: u64, - version: i32, + version: SchemaVersion, prefix: Type, sql: Option, applied_on: Option, @@ -105,7 +105,7 @@ impl Migration { // Create a migration from an applied migration on the database pub fn applied( - version: i32, + version: SchemaVersion, name: String, applied_on: OffsetDateTime, checksum: u64, @@ -134,8 +134,8 @@ impl Migration { } /// Get the Migration version - pub fn version(&self) -> u32 { - self.version as u32 + pub fn version(&self) -> SchemaVersion { + self.version } /// Get the Prefix diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index d7fae366..bd8f42af 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -126,7 +126,7 @@ where { // Needed cause some database vendors like Mssql have a non sql standard way of checking the migrations table fn assert_migrations_table_query(migration_table_name: &str) -> String { - ASSERT_MIGRATIONS_TABLE_QUERY.replace("%MIGRATION_TABLE_NAME%", migration_table_name) + super::assert_migrations_table_query(migration_table_name) } fn get_last_applied_migration_query(migration_table_name: &str) -> String { diff --git a/refinery_core/src/traits/mod.rs b/refinery_core/src/traits/mod.rs index d3eef6d3..6bda4142 100644 --- a/refinery_core/src/traits/mod.rs +++ b/refinery_core/src/traits/mod.rs @@ -4,6 +4,7 @@ pub mod r#async; pub mod sync; use crate::runner::Type; +use crate::util::SchemaVersion; use crate::{error::Kind, Error, Migration}; // Verifies applied and to be applied migrations returning Error if: @@ -49,10 +50,10 @@ pub(crate) fn verify_migrations( } } - let current: i32 = match applied.last() { + let current: SchemaVersion = match applied.last() { Some(last) => { log::info!("current version: {}", last.version()); - last.version() as i32 + last.version() as SchemaVersion } None => { log::info!("schema history table is empty, going to apply all migrations"); @@ -73,7 +74,7 @@ pub(crate) fn verify_migrations( if to_be_applied.contains(&migration) { return Err(Error::new(Kind::RepeatedVersion(migration), None)); } else if migration.prefix() == &Type::Versioned - && current >= migration.version() as i32 + && current >= migration.version() as SchemaVersion { if abort_missing { return Err(Error::new(Kind::MissingVersion(migration), None)); @@ -105,11 +106,24 @@ pub(crate) fn insert_migration_query(migration: &Migration, migration_table_name pub(crate) const ASSERT_MIGRATIONS_TABLE_QUERY: &str = "CREATE TABLE IF NOT EXISTS %MIGRATION_TABLE_NAME%( - version INT4 PRIMARY KEY, + version %VERSION_TYPE% PRIMARY KEY, name VARCHAR(255), applied_on VARCHAR(255), checksum VARCHAR(255));"; +pub(crate) fn assert_migrations_table_query(migration_table_name: &str) -> String { + ASSERT_MIGRATIONS_TABLE_QUERY + .replace("%MIGRATION_TABLE_NAME%", migration_table_name) + .replace( + "%VERSION_TYPE%", + if cfg!(feature = "int8-versions") { + "int8" + } else { + "int4" + }, + ) +} + pub(crate) const GET_APPLIED_MIGRATIONS_QUERY: &str = "SELECT version, name, applied_on, checksum \ FROM %MIGRATION_TABLE_NAME% ORDER BY version ASC;"; diff --git a/refinery_core/src/traits/sync.rs b/refinery_core/src/traits/sync.rs index e138e3c5..ff208797 100644 --- a/refinery_core/src/traits/sync.rs +++ b/refinery_core/src/traits/sync.rs @@ -105,7 +105,7 @@ where { // Needed cause some database vendors like Mssql have a non sql standard way of checking the migrations table fn assert_migrations_table_query(migration_table_name: &str) -> String { - ASSERT_MIGRATIONS_TABLE_QUERY.replace("%MIGRATION_TABLE_NAME%", migration_table_name) + super::assert_migrations_table_query(migration_table_name) } fn get_last_applied_migration_query(migration_table_name: &str) -> String { @@ -118,7 +118,7 @@ where fn assert_migrations_table(&mut self, migration_table_name: &str) -> Result { // Needed cause some database vendors like Mssql have a non sql standard way of checking the migrations table, - // thou on this case it's just to be consistent with the async trait `AsyncMigrate` + // though on this case it's just to be consistent with the async trait `AsyncMigrate` self.execute(&[Self::assert_migrations_table_query(migration_table_name).as_str()]) .migration_err("error asserting migrations table", None) } diff --git a/refinery_core/src/util.rs b/refinery_core/src/util.rs index 4b416f45..64c43889 100644 --- a/refinery_core/src/util.rs +++ b/refinery_core/src/util.rs @@ -7,6 +7,11 @@ use std::path::{Path, PathBuf}; use std::sync::OnceLock; use walkdir::{DirEntry, WalkDir}; +#[cfg(not(feature = "int8-versions"))] +pub type SchemaVersion = i32; +#[cfg(feature = "int8-versions")] +pub type SchemaVersion = i64; + const STEM_RE: &str = r"^([U|V])(\d+(?:\.\d+)?)__(\w+)"; /// Matches the stem of a migration file. @@ -44,12 +49,12 @@ impl MigrationType { } /// Parse a migration filename stem into a prefix, version, and name. -pub fn parse_migration_name(name: &str) -> Result<(Type, i32, String), Error> { +pub fn parse_migration_name(name: &str) -> Result<(Type, SchemaVersion, String), Error> { let captures = file_stem_re() .captures(name) .filter(|caps| caps.len() == 4) .ok_or_else(|| Error::new(Kind::InvalidName, None))?; - let version: i32 = captures[2] + let version: SchemaVersion = captures[2] .parse() .map_err(|_| Error::new(Kind::InvalidVersion, None))?; diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 53ea21e2..00cc570f 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -9,7 +9,8 @@ repository = "https://github.com/rust-db/refinery" edition = "2018" [features] -enums = [] +enums = ["dep:heck"] +int8-versions = ["refinery-core/int8-versions"] [lib] proc-macro = true @@ -20,7 +21,7 @@ quote = "1" syn = "2" proc-macro2 = "1" regex = "1" -heck = "0.5" +heck = { version = "0.5", optional = true } [dev-dependencies] tempfile = "3" diff --git a/refinery_macros/src/lib.rs b/refinery_macros/src/lib.rs index a185058b..cd790cc1 100644 --- a/refinery_macros/src/lib.rs +++ b/refinery_macros/src/lib.rs @@ -1,6 +1,7 @@ //! Contains Refinery macros that are used to import and embed migration files. #![recursion_limit = "128"] +#[cfg(feature = "enums")] use heck::ToUpperCamelCase; use proc_macro::TokenStream; use proc_macro2::{Span as Span2, TokenStream as TokenStream2}; @@ -19,7 +20,7 @@ pub(crate) fn crate_root() -> PathBuf { fn migration_fn_quoted(_migrations: Vec) -> TokenStream2 { let result = quote! { - use refinery::{Migration, Runner}; + use refinery::{Migration, Runner, SchemaVersion}; pub fn runner() -> Runner { let quoted_migrations: Vec<(&str, String)> = vec![#(#_migrations),*]; let mut migrations: Vec = Vec::new(); @@ -32,39 +33,53 @@ fn migration_fn_quoted(_migrations: Vec) -> TokenStream2 { result } +#[cfg(feature = "enums")] fn migration_enum_quoted(migration_names: &[impl AsRef]) -> TokenStream2 { - if cfg!(feature = "enums") { - let mut variants = Vec::new(); - let mut discriminants = Vec::new(); - - for m in migration_names { - let m = m.as_ref(); - let (_, version, name) = refinery_core::parse_migration_name(m) - .unwrap_or_else(|e| panic!("Couldn't parse migration filename '{}': {:?}", m, e)); - let variant = Ident::new(name.to_upper_camel_case().as_str(), Span2::call_site()); - variants.push(quote! { #variant(Migration) = #version }); - discriminants.push(quote! { #version => Self::#variant(migration) }); + use refinery_core::SchemaVersion; + + let mut variants = Vec::new(); + let mut discriminants = Vec::new(); + + for m in migration_names { + let m = m.as_ref(); + let (_, version, name) = refinery_core::parse_migration_name(m) + .unwrap_or_else(|e| panic!("Couldn't parse migration filename '{}': {:?}", m, e)); + let version: SchemaVersion = version; + let variant = Ident::new(name.to_upper_camel_case().as_str(), Span2::call_site()); + variants.push(quote! { #variant(Migration) = #version }); + discriminants.push(quote! { #version => Self::#variant(migration) }); + } + discriminants.push(quote! { v => panic!("Invalid migration version '{}'", v) }); + + #[cfg(feature = "int8-versions")] + let embedded = quote! { + #[repr(i64)] + #[derive(Debug)] + pub enum EmbeddedMigration { + #(#variants),* } - discriminants.push(quote! { v => panic!("Invalid migration version '{}'", v) }); + }; - let result = quote! { - #[repr(i32)] - #[derive(Debug)] - pub enum EmbeddedMigration { - #(#variants),* - } + #[cfg(not(feature = "int8-versions"))] + let embedded = quote! { + #[repr(i32)] + #[derive(Debug)] + pub enum EmbeddedMigration { + #(#variants),* + } + }; + + quote! { + + #embedded - impl From for EmbeddedMigration { - fn from(migration: Migration) -> Self { - match migration.version() as i32 { - #(#discriminants),* - } + impl From for EmbeddedMigration { + fn from(migration: Migration) -> Self { + match migration.version() as SchemaVersion { + #(#discriminants),* } } - }; - result - } else { - quote!() + } } } @@ -124,7 +139,11 @@ pub fn embed_migrations(input: TokenStream) -> TokenStream { } let fnq = migration_fn_quoted(_migrations); + #[cfg(feature = "enums")] let enums = migration_enum_quoted(migration_filenames.as_slice()); + #[cfg(not(feature = "enums"))] + let enums = quote!(); + (quote! { pub mod migrations { #(#migrations_mods)* @@ -139,18 +158,41 @@ pub fn embed_migrations(input: TokenStream) -> TokenStream { mod tests { use super::{migration_fn_quoted, quote}; + #[cfg(all(feature = "enums", feature = "int8-versions"))] + #[test] + fn test_enum_fn_i8() { + let expected = concat! { + "# [repr (i64)] ", + "# [derive (Debug)] ", + "pub enum EmbeddedMigration { ", + "Foo (Migration) = 1i64 , ", + "BarBaz (Migration) = 3i64 ", + "} ", + "impl From < Migration > for EmbeddedMigration { ", + "fn from (migration : Migration) -> Self { ", + "match migration . version () as SchemaVersion { ", + "1i64 => Self :: Foo (migration) , ", + "3i64 => Self :: BarBaz (migration) , ", + "v => panic ! (\"Invalid migration version '{}'\" , v) ", + "} } }" + }; + let enums = super::migration_enum_quoted(&["V1__foo", "U3__barBAZ"]).to_string(); + assert_eq!(expected, enums); + } + + #[cfg(all(feature = "enums", not(feature = "int8-versions")))] #[test] - #[cfg(feature = "enums")] fn test_enum_fn() { let expected = concat! { - "# [repr (i32)] # [derive (Debug)] ", + "# [repr (i32)] ", + "# [derive (Debug)] ", "pub enum EmbeddedMigration { ", "Foo (Migration) = 1i32 , ", "BarBaz (Migration) = 3i32 ", "} ", "impl From < Migration > for EmbeddedMigration { ", "fn from (migration : Migration) -> Self { ", - "match migration . version () as i32 { ", + "match migration . version () as SchemaVersion { ", "1i32 => Self :: Foo (migration) , ", "3i32 => Self :: BarBaz (migration) , ", "v => panic ! (\"Invalid migration version '{}'\" , v) ", @@ -164,7 +206,7 @@ mod tests { fn test_quote_fn() { let migs = vec![quote!("V1__first", "valid_sql_file")]; let expected = concat! { - "use refinery :: { Migration , Runner } ; ", + "use refinery :: { Migration , Runner , SchemaVersion } ; ", "pub fn runner () -> Runner { ", "let quoted_migrations : Vec < (& str , String) > = vec ! [\"V1__first\" , \"valid_sql_file\"] ; ", "let mut migrations : Vec < Migration > = Vec :: new () ; ", From d3fdf34c2e50e9d33f722aac9a7d71e16dd1aaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Sat, 26 Jul 2025 11:43:39 +0100 Subject: [PATCH 41/64] cargo clippy (#392) --- refinery/tests/mysql.rs | 6 ++---- refinery/tests/mysql_async.rs | 6 ++---- refinery/tests/postgres.rs | 10 ++++------ refinery/tests/rusqlite.rs | 9 +++------ refinery/tests/tiberius.rs | 6 ++---- refinery/tests/tokio_postgres.rs | 6 ++---- refinery_core/src/config.rs | 12 ++++++------ refinery_core/src/drivers/tiberius.rs | 7 +++---- refinery_core/src/runner.rs | 4 ++-- refinery_core/src/traits/async.rs | 6 +++--- refinery_core/src/traits/sync.rs | 4 ++-- 11 files changed, 31 insertions(+), 45 deletions(-) diff --git a/refinery/tests/mysql.rs b/refinery/tests/mysql.rs index a9c487bd..de2a25d6 100644 --- a/refinery/tests/mysql.rs +++ b/refinery/tests/mysql.rs @@ -125,8 +125,7 @@ mod mysql { let mut conn = pool.get_conn().unwrap(); embedded::migrations::runner().run(&mut conn).unwrap(); for row in format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", ) .run(conn) .unwrap() @@ -150,8 +149,7 @@ mod mysql { .unwrap(); for row in format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", ) .run(conn) .unwrap() diff --git a/refinery/tests/mysql_async.rs b/refinery/tests/mysql_async.rs index a3892ae4..a9069b7c 100644 --- a/refinery/tests/mysql_async.rs +++ b/refinery/tests/mysql_async.rs @@ -95,8 +95,7 @@ mod mysql_async { .unwrap(); conn.query(format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", )) .await .unwrap() @@ -123,8 +122,7 @@ mod mysql_async { let result = conn .query(format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", )) .await .unwrap(); diff --git a/refinery/tests/postgres.rs b/refinery/tests/postgres.rs index c4aa6308..00793694 100644 --- a/refinery/tests/postgres.rs +++ b/refinery/tests/postgres.rs @@ -130,8 +130,7 @@ mod postgres { for row in &client .query( &format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", ), &[], ) @@ -156,8 +155,7 @@ mod postgres { for row in &client .query( &format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", ), &[], ) @@ -295,7 +293,7 @@ mod postgres { let result = broken::migrations::runner().run(&mut client); assert!(result.is_err()); - println!("CURRENT: {:?}", result); + println!("CURRENT: {result:?}"); let current = client .get_last_applied_migration(DEFAULT_TABLE_NAME) @@ -341,7 +339,7 @@ mod postgres { .run(&mut client); assert!(result.is_err()); - println!("CURRENT: {:?}", result); + println!("CURRENT: {result:?}"); let query = &client .query("SELECT version FROM refinery_schema_history", &[]) diff --git a/refinery/tests/rusqlite.rs b/refinery/tests/rusqlite.rs index 258af424..f7807d69 100644 --- a/refinery/tests/rusqlite.rs +++ b/refinery/tests/rusqlite.rs @@ -141,8 +141,7 @@ mod rusqlite { let table_name: String = conn .query_row( &format!( - "SELECT name FROM sqlite_master WHERE type='table' AND name='{}'", - DEFAULT_TABLE_NAME + "SELECT name FROM sqlite_master WHERE type='table' AND name='{DEFAULT_TABLE_NAME}'", ), [], |row| row.get(0), @@ -161,8 +160,7 @@ mod rusqlite { let table_name: String = conn .query_row( &format!( - "SELECT name FROM sqlite_master WHERE type='table' AND name='{}'", - DEFAULT_TABLE_NAME + "SELECT name FROM sqlite_master WHERE type='table' AND name='{DEFAULT_TABLE_NAME}'", ), [], |row| row.get(0), @@ -181,8 +179,7 @@ mod rusqlite { let table_name: String = conn .query_row( &format!( - "SELECT name FROM sqlite_master WHERE type='table' AND name='{}'", - DEFAULT_TABLE_NAME + "SELECT name FROM sqlite_master WHERE type='table' AND name='{DEFAULT_TABLE_NAME}'", ), [], |row| row.get(0), diff --git a/refinery/tests/tiberius.rs b/refinery/tests/tiberius.rs index f6346063..e6dcb8d4 100644 --- a/refinery/tests/tiberius.rs +++ b/refinery/tests/tiberius.rs @@ -292,8 +292,7 @@ mod tiberius { let row = client .simple_query(&format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", )) .await .unwrap() @@ -334,8 +333,7 @@ mod tiberius { let row = client .simple_query(&format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", )) .await .unwrap() diff --git a/refinery/tests/tokio_postgres.rs b/refinery/tests/tokio_postgres.rs index e086eccd..304c85e7 100644 --- a/refinery/tests/tokio_postgres.rs +++ b/refinery/tests/tokio_postgres.rs @@ -156,8 +156,7 @@ mod tokio_postgres { let rows = client .query( &format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", ), &[], ) @@ -193,8 +192,7 @@ mod tokio_postgres { let rows = client .query( &format!( - "SELECT table_name FROM information_schema.tables WHERE table_name='{}'", - DEFAULT_TABLE_NAME + "SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'", ), &[], ) diff --git a/refinery_core/src/config.rs b/refinery_core/src/config.rs index 0d6319ad..bbb3b1da 100644 --- a/refinery_core/src/config.rs +++ b/refinery_core/src/config.rs @@ -52,7 +52,7 @@ impl Config { pub fn from_env_var(name: &str) -> Result { let value = std::env::var(name).map_err(|_| { Error::new( - Kind::ConfigError(format!("Couldn't find {} environment variable", name)), + Kind::ConfigError(format!("Couldn't find {name} environment variable")), None, ) })?; @@ -64,14 +64,14 @@ impl Config { pub fn from_file_location>(location: T) -> Result { let file = std::fs::read_to_string(&location).map_err(|err| { Error::new( - Kind::ConfigError(format!("could not open config file, {}", err)), + Kind::ConfigError(format!("could not open config file, {err}")), None, ) })?; let mut config: Config = toml::from_str(&file).map_err(|err| { Error::new( - Kind::ConfigError(format!("could not parse config file, {}", err)), + Kind::ConfigError(format!("could not parse config file, {err}")), None, ) })?; @@ -99,7 +99,7 @@ impl Config { let config_db_path = config_db_path.canonicalize().map_err(|err| { Error::new( - Kind::ConfigError(format!("invalid sqlite db path, {}", err)), + Kind::ConfigError(format!("invalid sqlite db path, {err}")), None, ) })?; @@ -293,7 +293,7 @@ impl FromStr for Config { fn from_str(url_str: &str) -> Result { let url = Url::parse(url_str).map_err(|_| { Error::new( - Kind::ConfigError(format!("Couldn't parse the string '{}' as a URL", url_str)), + Kind::ConfigError(format!("Couldn't parse the string '{url_str}' as a URL")), None, ) })?; @@ -365,7 +365,7 @@ cfg_if::cfg_if! { if let Some(port) = &config.main.db_port { let port = port.parse().map_err(|_| Error::new( - Kind::ConfigError(format!("Couldn't parse value {} as mssql port", port)), + Kind::ConfigError(format!("Couldn't parse value {port} as mssql port")), None, ))?; tconfig.port(port); diff --git a/refinery_core/src/drivers/tiberius.rs b/refinery_core/src/drivers/tiberius.rs index a30e0311..4218ee7d 100644 --- a/refinery_core/src/drivers/tiberius.rs +++ b/refinery_core/src/drivers/tiberius.rs @@ -86,15 +86,14 @@ where { fn assert_migrations_table_query(migration_table_name: &str) -> String { format!( - "IF NOT EXISTS(SELECT 1 FROM sys.Tables WHERE Name = N'{table_name}') + "IF NOT EXISTS(SELECT 1 FROM sys.Tables WHERE Name = N'{migration_table_name}') BEGIN - CREATE TABLE {table_name}( + CREATE TABLE {migration_table_name}( version INT PRIMARY KEY, name VARCHAR(255), applied_on VARCHAR(255), checksum VARCHAR(255)); - END", - table_name = migration_table_name + END" ) } } diff --git a/refinery_core/src/runner.rs b/refinery_core/src/runner.rs index d6d93afb..97921e81 100644 --- a/refinery_core/src/runner.rs +++ b/refinery_core/src/runner.rs @@ -25,7 +25,7 @@ impl fmt::Display for Type { Type::Versioned => "V", Type::Unversioned => "U", }; - write!(f, "{}", version_type) + write!(f, "{version_type}") } } @@ -35,7 +35,7 @@ impl fmt::Debug for Type { Type::Versioned => "Versioned", Type::Unversioned => "Unversioned", }; - write!(f, "{}", version_type) + write!(f, "{version_type}") } } diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index bd8f42af..8e42337e 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -1,7 +1,7 @@ use crate::error::WrapMigrationError; use crate::traits::{ - insert_migration_query, verify_migrations, ASSERT_MIGRATIONS_TABLE_QUERY, - GET_APPLIED_MIGRATIONS_QUERY, GET_LAST_APPLIED_MIGRATION_QUERY, + insert_migration_query, verify_migrations, GET_APPLIED_MIGRATIONS_QUERY, + GET_LAST_APPLIED_MIGRATION_QUERY, }; use crate::{Error, Migration, Report, Target}; @@ -49,7 +49,7 @@ async fn migrate( ]) .await .migration_err( - &format!("error applying migration {}", migration), + &format!("error applying migration {migration}"), Some(&applied_migrations), )?; applied_migrations.push(migration); diff --git a/refinery_core/src/traits/sync.rs b/refinery_core/src/traits/sync.rs index ff208797..0225f879 100644 --- a/refinery_core/src/traits/sync.rs +++ b/refinery_core/src/traits/sync.rs @@ -1,7 +1,7 @@ use crate::error::WrapMigrationError; use crate::traits::{ - insert_migration_query, verify_migrations, ASSERT_MIGRATIONS_TABLE_QUERY, - GET_APPLIED_MIGRATIONS_QUERY, GET_LAST_APPLIED_MIGRATION_QUERY, + insert_migration_query, verify_migrations, GET_APPLIED_MIGRATIONS_QUERY, + GET_LAST_APPLIED_MIGRATION_QUERY, }; use crate::{Error, Migration, Report, Target}; From b7c8d44990f56a9d632a14c9740d72c8e23872e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Sat, 26 Jul 2025 13:49:57 +0100 Subject: [PATCH 42/64] update migrate Transaction and AsyncTransaction (#393) execute functions, to avoid double iteration. --- refinery_core/src/drivers/config.rs | 10 +++++-- refinery_core/src/drivers/mysql.rs | 14 ++++++--- refinery_core/src/drivers/mysql_async.rs | 7 +++-- refinery_core/src/drivers/postgres.rs | 7 +++-- refinery_core/src/drivers/rusqlite.rs | 7 +++-- refinery_core/src/drivers/tiberius.rs | 7 +++-- refinery_core/src/drivers/tokio_postgres.rs | 5 +++- refinery_core/src/traits/async.rs | 32 ++++++++++++--------- refinery_core/src/traits/sync.rs | 19 +++++++----- 9 files changed, 73 insertions(+), 35 deletions(-) diff --git a/refinery_core/src/drivers/config.rs b/refinery_core/src/drivers/config.rs index c7539028..9a9067ba 100644 --- a/refinery_core/src/drivers/config.rs +++ b/refinery_core/src/drivers/config.rs @@ -18,7 +18,10 @@ use std::convert::Infallible; impl Transaction for Config { type Error = Infallible; - fn execute(&mut self, _queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + _queries: T, + ) -> Result { Ok(0) } } @@ -33,7 +36,10 @@ impl Query> for Config { impl AsyncTransaction for Config { type Error = Infallible; - async fn execute(&mut self, _queries: &[&str]) -> Result { + async fn execute<'a, T: Iterator + Send>( + &mut self, + _queries: T, + ) -> Result { Ok(0) } } diff --git a/refinery_core/src/drivers/mysql.rs b/refinery_core/src/drivers/mysql.rs index 33148d94..c2947152 100644 --- a/refinery_core/src/drivers/mysql.rs +++ b/refinery_core/src/drivers/mysql.rs @@ -43,10 +43,13 @@ fn query_applied_migrations( impl Transaction for Conn { type Error = MError; - fn execute(&mut self, queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result { let mut transaction = self.start_transaction(get_tx_opts())?; let mut count = 0; - for query in queries.iter() { + for query in queries { transaction.query_iter(query)?; count += 1; } @@ -58,11 +61,14 @@ impl Transaction for Conn { impl Transaction for PooledConn { type Error = MError; - fn execute(&mut self, queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result { let mut transaction = self.start_transaction(get_tx_opts())?; let mut count = 0; - for query in queries.iter() { + for query in queries { transaction.query_iter(query)?; count += 1; } diff --git a/refinery_core/src/drivers/mysql_async.rs b/refinery_core/src/drivers/mysql_async.rs index c92fcd86..675b96f9 100644 --- a/refinery_core/src/drivers/mysql_async.rs +++ b/refinery_core/src/drivers/mysql_async.rs @@ -40,7 +40,10 @@ async fn query_applied_migrations<'a>( impl AsyncTransaction for Pool { type Error = MError; - async fn execute(&mut self, queries: &[&str]) -> Result { + async fn execute<'a, T: Iterator + Send>( + &mut self, + queries: T, + ) -> Result { let mut conn = self.get_conn().await?; let mut options = TxOpts::new(); options.with_isolation_level(Some(IsolationLevel::ReadCommitted)); @@ -48,7 +51,7 @@ impl AsyncTransaction for Pool { let mut transaction = conn.start_transaction(options).await?; let mut count = 0; for query in queries { - transaction.query_drop(*query).await?; + transaction.query_drop(query).await?; count += 1; } transaction.commit().await?; diff --git a/refinery_core/src/drivers/postgres.rs b/refinery_core/src/drivers/postgres.rs index 3d177509..fa4d5b9e 100644 --- a/refinery_core/src/drivers/postgres.rs +++ b/refinery_core/src/drivers/postgres.rs @@ -33,10 +33,13 @@ fn query_applied_migrations( impl Transaction for PgClient { type Error = PgError; - fn execute(&mut self, queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result { let mut transaction = PgClient::transaction(self)?; let mut count = 0; - for query in queries.iter() { + for query in queries { PgTransaction::batch_execute(&mut transaction, query)?; count += 1; } diff --git a/refinery_core/src/drivers/rusqlite.rs b/refinery_core/src/drivers/rusqlite.rs index 9547ba48..9ee4ced9 100644 --- a/refinery_core/src/drivers/rusqlite.rs +++ b/refinery_core/src/drivers/rusqlite.rs @@ -32,10 +32,13 @@ fn query_applied_migrations( impl Transaction for RqlConnection { type Error = RqlError; - fn execute(&mut self, queries: &[&str]) -> Result { + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result { let transaction = self.transaction()?; let mut count = 0; - for query in queries.iter() { + for query in queries { transaction.execute_batch(query)?; count += 1; } diff --git a/refinery_core/src/drivers/tiberius.rs b/refinery_core/src/drivers/tiberius.rs index 4218ee7d..4095f1b7 100644 --- a/refinery_core/src/drivers/tiberius.rs +++ b/refinery_core/src/drivers/tiberius.rs @@ -47,13 +47,16 @@ where { type Error = Error; - async fn execute(&mut self, queries: &[&str]) -> Result { + async fn execute<'a, T: Iterator + Send>( + &mut self, + queries: T, + ) -> Result { // Tiberius doesn't support transactions, see https://github.com/prisma/tiberius/issues/28 self.simple_query("BEGIN TRAN T1;").await?; let mut count = 0; for query in queries { // Drop the returning `QueryStream<'a>` to avoid compiler complaning regarding lifetimes - if let Err(err) = self.simple_query(*query).await.map(drop) { + if let Err(err) = self.simple_query(query).await.map(drop) { if let Err(err) = self.simple_query("ROLLBACK TRAN T1").await { log::error!("could not ROLLBACK transaction, {}", err); } diff --git a/refinery_core/src/drivers/tokio_postgres.rs b/refinery_core/src/drivers/tokio_postgres.rs index ec8bb9c8..346cfd7c 100644 --- a/refinery_core/src/drivers/tokio_postgres.rs +++ b/refinery_core/src/drivers/tokio_postgres.rs @@ -35,7 +35,10 @@ async fn query_applied_migrations( impl AsyncTransaction for Client { type Error = PgError; - async fn execute(&mut self, queries: &[&str]) -> Result { + async fn execute<'a, T: Iterator + Send>( + &mut self, + queries: T, + ) -> Result { let transaction = self.transaction().await?; let mut count = 0; for query in queries { diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index 8e42337e..a0305d2e 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -12,7 +12,10 @@ use std::string::ToString; pub trait AsyncTransaction { type Error: std::error::Error + Send + Sync + 'static; - async fn execute(&mut self, query: &[&str]) -> Result; + async fn execute<'a, T: Iterator + Send>( + &mut self, + queries: T, + ) -> Result; } #[async_trait] @@ -43,10 +46,13 @@ async fn migrate( migration.set_applied(); let update_query = insert_migration_query(&migration, migration_table_name); transaction - .execute(&[ - migration.sql().as_ref().expect("sql must be Some!"), - &update_query, - ]) + .execute( + [ + migration.sql().as_ref().expect("sql must be Some!"), + update_query.as_str(), + ] + .into_iter(), + ) .await .migration_err( &format!("error applying migration {migration}"), @@ -109,10 +115,8 @@ async fn migrate_grouped( ); } - let refs: Vec<&str> = grouped_migrations.iter().map(AsRef::as_ref).collect(); - transaction - .execute(refs.as_ref()) + .execute(grouped_migrations.iter().map(AsRef::as_ref)) .await .migration_err("error applying migrations", None)?; @@ -142,7 +146,7 @@ where migration_table_name: &str, ) -> Result, Error> { let mut migrations = self - .query(Self::get_last_applied_migration_query(migration_table_name).as_str()) + .query(Self::get_last_applied_migration_query(migration_table_name).as_ref()) .await .migration_err("error getting last applied migration", None)?; @@ -154,7 +158,7 @@ where migration_table_name: &str, ) -> Result, Error> { let migrations = self - .query(Self::get_applied_migrations_query(migration_table_name).as_str()) + .query(Self::get_applied_migrations_query(migration_table_name).as_ref()) .await .migration_err("error getting applied migrations", None)?; @@ -170,9 +174,11 @@ where target: Target, migration_table_name: &str, ) -> Result { - self.execute(&[&Self::assert_migrations_table_query(migration_table_name)]) - .await - .migration_err("error asserting migrations table", None)?; + self.execute( + [Self::assert_migrations_table_query(migration_table_name).as_ref()].into_iter(), + ) + .await + .migration_err("error asserting migrations table", None)?; let applied_migrations = self .get_applied_migrations(migration_table_name) diff --git a/refinery_core/src/traits/sync.rs b/refinery_core/src/traits/sync.rs index 0225f879..f7ad2a65 100644 --- a/refinery_core/src/traits/sync.rs +++ b/refinery_core/src/traits/sync.rs @@ -8,7 +8,10 @@ use crate::{Error, Migration, Report, Target}; pub trait Transaction { type Error: std::error::Error + Send + Sync + 'static; - fn execute(&mut self, queries: &[&str]) -> Result; + fn execute<'a, T: Iterator>( + &mut self, + queries: T, + ) -> Result; } pub trait Query: Transaction { @@ -66,7 +69,7 @@ pub fn migrate( } }; - let refs: Vec<&str> = migration_batch.iter().map(AsRef::as_ref).collect(); + let refs = migration_batch.iter().map(AsRef::as_ref); if batched { let migrations_display = applied_migrations @@ -76,10 +79,10 @@ pub fn migrate( .join("\n"); log::info!("going to apply batch migrations in single transaction:\n{migrations_display}"); transaction - .execute(refs.as_ref()) + .execute(refs) .migration_err("error applying migrations", None)?; } else { - for (i, update) in refs.iter().enumerate() { + for (i, update) in refs.enumerate() { // first iteration is pair so we know the following even in the iteration index // marks the previous (pair) migration as completed. let applying_migration = i % 2 == 0; @@ -91,7 +94,7 @@ pub fn migrate( log::debug!("applied migration: {current_migration} writing state to db."); } transaction - .execute(&[update]) + .execute([update].into_iter()) .migration_err("error applying update", Some(&applied_migrations[0..i / 2]))?; } } @@ -119,8 +122,10 @@ where fn assert_migrations_table(&mut self, migration_table_name: &str) -> Result { // Needed cause some database vendors like Mssql have a non sql standard way of checking the migrations table, // though on this case it's just to be consistent with the async trait `AsyncMigrate` - self.execute(&[Self::assert_migrations_table_query(migration_table_name).as_str()]) - .migration_err("error asserting migrations table", None) + self.execute( + [Self::assert_migrations_table_query(migration_table_name).as_ref()].into_iter(), + ) + .migration_err("error asserting migrations table", None) } fn get_last_applied_migration( From 825a9805b5e18f886b16594c374b092f09fa9ba6 Mon Sep 17 00:00:00 2001 From: Markus Wendorf Date: Mon, 6 Oct 2025 11:38:50 +0200 Subject: [PATCH 43/64] feat: derive Serialize for Migration if serde is enabled (#395) * feat: derive Serialize for Migration if serde is enabled * time/serde dep feature * ci --- refinery_core/Cargo.toml | 2 +- refinery_core/src/runner.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 026da02e..87c65ccd 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -13,7 +13,7 @@ default = [] mysql_async = ["dep:mysql_async"] postgres = ["dep:postgres", "dep:postgres-native-tls", "dep:native-tls"] rusqlite-bundled = ["rusqlite", "rusqlite/bundled"] -serde = ["dep:serde"] +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"] diff --git a/refinery_core/src/runner.rs b/refinery_core/src/runner.rs index 97921e81..adf34d10 100644 --- a/refinery_core/src/runner.rs +++ b/refinery_core/src/runner.rs @@ -14,6 +14,7 @@ use std::fmt::Formatter; /// An enum set that represents the type of the Migration #[derive(Clone, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Type { Versioned, Unversioned, @@ -51,6 +52,7 @@ pub enum Target { // an Enum set that represents the state of the migration: Applied on the database, // or Unapplied yet to be applied on the database #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] enum State { Applied, Unapplied, @@ -62,6 +64,7 @@ enum State { /// /// [`embed_migrations!`]: macro.embed_migrations.html #[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Migration { state: State, name: String, From 6c9a90b75f065b50bfccedfa960d1a55f5bcb3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Mon, 6 Oct 2025 11:20:16 +0100 Subject: [PATCH 44/64] support mysq_async 0.36 (#400) --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 87c65ccd..4e67c30e 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -37,7 +37,7 @@ native-tls = { version = "0.2", optional = true } postgres-native-tls = { version = "0.5", optional = true} tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 26", optional = true, default-features = false, features = ["minimal"] } -mysql_async = { version = ">= 0.28, <= 0.35", optional = true, default-features = false, features = ["minimal"] } +mysql_async = { version = ">= 0.28, <= 0.36", optional = true, default-features = false, features = ["minimal"] } tiberius = { version = ">= 0.7, <= 0.12", optional = true, default-features = false } tokio = { version = "1.0", optional = true } futures = { version = "0.3.16", optional = true, features = ["async-await"] } From edab9fec05405cd74ae1a706dbfc9b02f8e3c9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Mon, 6 Oct 2025 16:02:00 +0100 Subject: [PATCH 45/64] update MSRV (#401) --- .github/workflows/ci.yml | 2 +- Cargo.toml | 3 +++ refinery/Cargo.toml | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33961942..d4d2ed36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@v2 - id: set-versions run: | - MSRV=$(grep -oP 'rust-version\s*=\s*"\K[^"]+' ./refinery/Cargo.toml) + MSRV=$(grep -oP 'rust-version\s*=\s*"\K[^"]+' ./Cargo.toml) echo "versions=['stable', 'nightly', '$MSRV']" >> $GITHUB_OUTPUT cargo-fmt-clippy: diff --git a/Cargo.toml b/Cargo.toml index 9cd4a9ed..b7334254 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,9 @@ members = [ "examples", ] +[workspace.package] +rust-version = "1.85" + [profile.release] codegen-units = 1 lto = true diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index ef1ab995..4e21892c 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,7 +1,6 @@ [package] name = "refinery" version = "0.8.16" -rust-version = "1.83" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" description = "Powerful SQL migration toolkit for Rust" From dc4296c40f8516ab2408279d7cc07abb7e77e926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Wed, 8 Oct 2025 15:38:54 +0100 Subject: [PATCH 46/64] chore: fix unused warnings (#403) --- refinery_cli/src/migrate.rs | 10 +- refinery_cli/src/setup.rs | 62 +++-- refinery_core/src/config.rs | 398 +++++++++++++++++++--------- refinery_core/src/drivers/config.rs | 29 +- 4 files changed, 328 insertions(+), 171 deletions(-) diff --git a/refinery_cli/src/migrate.rs b/refinery_cli/src/migrate.rs index 77deae02..cd9557a4 100644 --- a/refinery_cli/src/migrate.rs +++ b/refinery_cli/src/migrate.rs @@ -3,7 +3,7 @@ use std::path::Path; use anyhow::Context; use refinery_core::{ config::{Config, ConfigDbType}, - find_migration_files, Migration, MigrationType, Runner, SchemaVersion, Target, + find_migration_files, Migration, MigrationType, SchemaVersion, Target, }; use crate::cli::MigrateArgs; @@ -19,8 +19,7 @@ pub fn handle_migration_command(args: MigrateArgs) -> anyhow::Result<()> { args.env_var.as_deref(), &args.path, &args.table_name, - )?; - Ok(()) + ) } #[allow(clippy::too_many_arguments)] @@ -73,7 +72,7 @@ fn run_migrations( .context("Can't start tokio runtime")?; runtime.block_on(async { - Runner::new(&migrations) + refinery_core::Runner::new(&migrations) .set_grouped(grouped) .set_target(target) .set_abort_divergent(divergent) @@ -90,7 +89,7 @@ fn run_migrations( _db_type @ (ConfigDbType::Mysql | ConfigDbType::Postgres | ConfigDbType::Sqlite) => { cfg_if::cfg_if! { if #[cfg(any(feature = "mysql", feature = "postgresql", feature = "sqlite"))] { - Runner::new(&migrations) + refinery_core::Runner::new(&migrations) .set_grouped(grouped) .set_abort_divergent(divergent) .set_abort_missing(missing) @@ -103,7 +102,6 @@ fn run_migrations( } } }; - Ok(()) } diff --git a/refinery_cli/src/setup.rs b/refinery_cli/src/setup.rs index e6e06f90..6429df71 100644 --- a/refinery_cli/src/setup.rs +++ b/refinery_cli/src/setup.rs @@ -59,35 +59,45 @@ fn get_config_from_input() -> Result { } } - print!("Enter database host: "); - io::stdout().flush()?; - let mut db_host = String::new(); - io::stdin().read_line(&mut db_host)?; - config = config.set_db_host(db_host.trim()); + cfg_if::cfg_if! { + if #[cfg(any( + feature = "mysql", + feature = "mssql", + feature = "postgresql", + ))]{ + print!("Enter database host: "); + io::stdout().flush()?; + let mut db_host = String::new(); + io::stdin().read_line(&mut db_host)?; + config = config.set_db_host(db_host.trim()); - print!("Enter database port: "); - io::stdout().flush()?; - let mut db_port = String::new(); - io::stdin().read_line(&mut db_port)?; - config = config.set_db_port(db_port.trim()); + print!("Enter database port: "); + io::stdout().flush()?; + let mut db_port = String::new(); + io::stdin().read_line(&mut db_port)?; + config = config.set_db_port(db_port.trim()); - print!("Enter database username: "); - io::stdout().flush()?; - let mut db_user = String::new(); - io::stdin().read_line(&mut db_user)?; - config = config.set_db_user(db_user.trim()); + print!("Enter database username: "); + io::stdout().flush()?; + let mut db_user = String::new(); + io::stdin().read_line(&mut db_user)?; + config = config.set_db_user(db_user.trim()); - print!("Enter database password: "); - io::stdout().flush()?; - let mut db_pass = String::new(); - io::stdin().read_line(&mut db_pass)?; - config = config.set_db_pass(db_pass.trim()); + print!("Enter database password: "); + io::stdout().flush()?; + let mut db_pass = String::new(); + io::stdin().read_line(&mut db_pass)?; + config = config.set_db_pass(db_pass.trim()); - print!("Enter database name: "); - io::stdout().flush()?; - let mut db_name = String::new(); - io::stdin().read_line(&mut db_name)?; - config = config.set_db_name(db_name.trim()); + print!("Enter database name: "); + io::stdout().flush()?; + let mut db_name = String::new(); + io::stdin().read_line(&mut db_name)?; + config = config.set_db_name(db_name.trim()); - Ok(config) + Ok(config) + } else { + Ok(config) + } + } } diff --git a/refinery_core/src/config.rs b/refinery_core/src/config.rs index bbb3b1da..ca1b0101 100644 --- a/refinery_core/src/config.rs +++ b/refinery_core/src/config.rs @@ -1,14 +1,13 @@ use crate::error::Kind; use crate::Error; -use std::convert::TryFrom; -use std::path::PathBuf; -use std::str::FromStr; #[cfg(any( feature = "postgres", feature = "tokio-postgres", feature = "tiberius-config" ))] -use std::{borrow::Cow, collections::HashMap}; +use std::borrow::Cow; +use std::convert::TryFrom; +use std::str::FromStr; use url::Url; // refinery config file used by migrate_from_config if migration from a Config struct is preferred instead of using the macros @@ -32,19 +31,7 @@ impl Config { /// create a new config instance pub fn new(db_type: ConfigDbType) -> Config { Config { - main: Main { - db_type, - db_path: None, - db_host: None, - db_port: None, - db_user: None, - db_pass: None, - db_name: None, - #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] - use_tls: false, - #[cfg(feature = "tiberius-config")] - trust_cert: false, - }, + main: Main::new(db_type), } } @@ -59,6 +46,10 @@ impl Config { Config::from_str(&value) } + pub fn db_type(&self) -> ConfigDbType { + self.main.db_type + } + /// create a new Config instance from a config file located on the file system #[cfg(feature = "toml")] pub fn from_file_location>(location: T) -> Result { @@ -69,7 +60,7 @@ impl Config { ) })?; - let mut config: Config = toml::from_str(&file).map_err(|err| { + let config: Config = toml::from_str(&file).map_err(|err| { Error::new( Kind::ConfigError(format!("could not parse config file, {err}")), None, @@ -77,7 +68,9 @@ impl Config { })?; //replace relative path with canonical path in case of Sqlite db + #[cfg(feature = "rusqlite")] if config.main.db_type == ConfigDbType::Sqlite { + let mut config = config; let mut config_db_path = config.main.db_path.ok_or_else(|| { Error::new( Kind::ConfigError("field path must be present for Sqlite database type".into()), @@ -103,42 +96,28 @@ impl Config { None, ) })?; - config.main.db_path = Some(config_db_path); - } - - Ok(config) - } - cfg_if::cfg_if! { - if #[cfg(feature = "rusqlite")] { - pub(crate) fn db_path(&self) -> Option<&std::path::Path> { - self.main.db_path.as_deref() - } - - pub fn set_db_path(self, db_path: &str) -> Config { - Config { - main: Main { - db_path: Some(db_path.into()), - ..self.main - }, - } - } + return Ok(config); } - } - cfg_if::cfg_if! { - if #[cfg(feature = "tiberius-config")] { - pub fn set_trust_cert(&mut self) { - self.main.trust_cert = true; - } - } + Ok(config) } - pub fn db_type(&self) -> ConfigDbType { - self.main.db_type + #[cfg(feature = "tiberius-config")] + pub fn set_trust_cert(&mut self) { + self.main.trust_cert = true; } +} +#[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" +))] +impl Config { pub fn db_host(&self) -> Option<&str> { self.main.db_host.as_deref() } @@ -147,11 +126,6 @@ impl Config { self.main.db_port.as_deref() } - #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] - pub fn use_tls(&self) -> bool { - self.main.use_tls - } - pub fn set_db_user(self, db_user: &str) -> Config { Config { main: Main { @@ -196,8 +170,30 @@ impl Config { }, } } +} + +#[cfg(feature = "rusqlite")] +impl Config { + pub(crate) fn db_path(&self) -> Option<&std::path::Path> { + self.main.db_path.as_deref() + } + + pub fn set_db_path(self, db_path: &str) -> Config { + Config { + main: Main { + db_path: Some(db_path.into()), + ..self.main + }, + } + } +} + +#[cfg(any(feature = "postgres", feature = "tokio-postgres"))] +impl Config { + pub fn use_tls(&self) -> bool { + self.main.use_tls + } - #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] pub fn set_use_tls(self, use_tls: bool) -> Config { Config { main: Main { @@ -226,45 +222,10 @@ impl TryFrom for Config { } }; - #[cfg(any( - feature = "postgres", - feature = "tokio-postgres", - feature = "tiberius-config" - ))] - let query_params = url - .query_pairs() - .collect::, Cow<'_, str>>>(); - - cfg_if::cfg_if! { - if #[cfg(feature = "tiberius-config")] { - let trust_cert = query_params. - get("trust_cert") - .unwrap_or(&Cow::Borrowed("false")) - .parse::() - .map_err(|_| { - Error::new( - Kind::ConfigError("Invalid trust_cert value, please use true/false".into()), - None, - ) - })?; - } - } - - #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] - let use_tls = match query_params.get("sslmode") { - Some(Cow::Borrowed("require")) => true, - Some(Cow::Borrowed("disable")) | None => false, - _ => { - return Err(Error::new( - Kind::ConfigError("Invalid sslmode value, please use disable/require".into()), - None, - )) - } - }; - Ok(Self { main: Main { db_type, + #[cfg(feature = "rusqlite")] db_path: Some( url.as_str()[url.scheme().len()..] .trim_start_matches(':') @@ -272,15 +233,78 @@ impl TryFrom for Config { .to_string() .into(), ), + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_host: url.host_str().map(|r| r.to_string()), + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_port: url.port().map(|r| r.to_string()), + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_user: Some(url.username().to_string()), + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_pass: url.password().map(|r| r.to_string()), + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_name: Some(url.path().trim_start_matches('/').to_string()), #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] - use_tls, + use_tls: match url + .query_pairs() + .collect::, Cow<'_, str>>>() + .get("sslmode") + { + Some(Cow::Borrowed("require")) => true, + Some(Cow::Borrowed("disable")) | None => false, + _ => { + return Err(Error::new( + Kind::ConfigError( + "Invalid sslmode value, please use disable/require".into(), + ), + None, + )) + } + }, #[cfg(feature = "tiberius-config")] - trust_cert, + trust_cert: url + .query_pairs() + .collect::, Cow<'_, str>>>() + .get("trust_cert") + .unwrap_or(&Cow::Borrowed("false")) + .parse::() + .map_err(|_| { + Error::new( + Kind::ConfigError( + "Invalid trust_cert value, please use true/false".into(), + ), + None, + ) + })?, }, }) } @@ -305,11 +329,47 @@ impl FromStr for Config { #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] struct Main { db_type: ConfigDbType, - db_path: Option, + #[cfg(feature = "rusqlite")] + db_path: Option, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_host: Option, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_port: Option, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_user: Option, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_pass: Option, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] db_name: Option, #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] #[cfg_attr(feature = "serde", serde(default))] @@ -319,11 +379,65 @@ struct Main { trust_cert: bool, } +impl Main { + fn new(db_type: ConfigDbType) -> Self { + Main { + db_type, + #[cfg(feature = "rusqlite")] + db_path: None, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] + db_host: None, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] + db_port: None, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] + db_user: None, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] + db_pass: None, + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async", + feature = "tiberius-config" + ))] + db_name: None, + #[cfg(any(feature = "postgres", feature = "tokio-postgres"))] + use_tls: false, + #[cfg(feature = "tiberius-config")] + trust_cert: false, + } + } +} + #[cfg(any( feature = "mysql", feature = "postgres", feature = "tokio-postgres", - feature = "mysql_async" + feature = "mysql_async", ))] pub(crate) fn build_db_url(name: &str, config: &Config) -> String { let mut url: String = name.to_string() + "://"; @@ -350,52 +464,58 @@ pub(crate) fn build_db_url(name: &str, config: &Config) -> String { url } -cfg_if::cfg_if! { - if #[cfg(feature = "tiberius-config")] { - use tiberius::{AuthMethod, Config as TConfig}; - - impl TryFrom<&Config> for TConfig { - type Error=Error; - - fn try_from(config: &Config) -> Result { - let mut tconfig = TConfig::new(); - if let Some(host) = &config.main.db_host { - tconfig.host(host); - } +#[cfg(feature = "tiberius-config")] +impl TryFrom<&Config> for tiberius::Config { + type Error = Error; - if let Some(port) = &config.main.db_port { - let port = port.parse().map_err(|_| Error::new( - Kind::ConfigError(format!("Couldn't parse value {port} as mssql port")), - None, - ))?; - tconfig.port(port); - } + fn try_from(config: &Config) -> Result { + let mut tconfig = tiberius::Config::new(); + if let Some(host) = &config.main.db_host { + tconfig.host(host); + } - if let Some(db) = &config.main.db_name { - tconfig.database(db); - } + if let Some(port) = &config.main.db_port { + let port = port.parse().map_err(|_| { + Error::new( + Kind::ConfigError(format!("Couldn't parse value {port} as mssql port")), + None, + ) + })?; + tconfig.port(port); + } - let user = config.main.db_user.as_deref().unwrap_or(""); - let pass = config.main.db_pass.as_deref().unwrap_or(""); + if let Some(db) = &config.main.db_name { + tconfig.database(db); + } - if config.main.trust_cert { - tconfig.trust_cert(); - } - tconfig.authentication(AuthMethod::sql_server(user, pass)); + let user = config.main.db_user.as_deref().unwrap_or(""); + let pass = config.main.db_pass.as_deref().unwrap_or(""); - Ok(tconfig) - } + if config.main.trust_cert { + tconfig.trust_cert(); } + tconfig.authentication(tiberius::AuthMethod::sql_server(user, pass)); + + Ok(tconfig) } } #[cfg(test)] mod tests { - use super::{build_db_url, Config, Kind}; + use super::{Config, Kind}; use std::io::Write; use std::str::FromStr; + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async" + ))] + use super::build_db_url; + #[test] + #[cfg(feature = "toml")] fn returns_config_error_from_invalid_config_location() { let config = Config::from_file_location("invalid_path").unwrap_err(); match config.kind() { @@ -405,6 +525,7 @@ mod tests { } #[test] + #[cfg(feature = "toml")] fn returns_config_error_from_invalid_toml_file() { let config = "[<$% db_type = \"Sqlite\" \n"; @@ -419,6 +540,7 @@ mod tests { } #[test] + #[cfg(all(feature = "toml", feature = "rusqlite"))] fn returns_config_error_from_sqlite_with_missing_path() { let config = "[main] \n db_type = \"Sqlite\" \n"; @@ -435,6 +557,7 @@ mod tests { } #[test] + #[cfg(all(feature = "toml", feature = "rusqlite"))] fn builds_sqlite_path_from_relative_path() { let db_file = tempfile::NamedTempFile::new_in(".").unwrap(); @@ -458,6 +581,15 @@ mod tests { } #[test] + #[cfg(all( + feature = "toml", + any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async" + ) + ))] fn builds_db_url() { let config = "[main] \n db_type = \"Postgres\" \n @@ -476,12 +608,18 @@ mod tests { } #[test] + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async" + ))] fn builds_db_env_var() { std::env::set_var( - "DATABASE_URL", + "TEST_DATABASE_URL", "postgres://root:1234@localhost:5432/refinery", ); - let config = Config::from_env_var("DATABASE_URL").unwrap(); + let config = Config::from_env_var("TEST_DATABASE_URL").unwrap(); assert_eq!( "postgres://root:1234@localhost:5432/refinery", build_db_url("postgres", &config) @@ -489,6 +627,12 @@ mod tests { } #[test] + #[cfg(any( + feature = "mysql", + feature = "postgres", + feature = "tokio-postgres", + feature = "mysql_async" + ))] fn builds_from_str() { let config = Config::from_str("postgres://root:1234@localhost:5432/refinery").unwrap(); assert_eq!( @@ -538,8 +682,8 @@ mod tests { #[test] fn builds_db_env_var_failure() { - std::env::set_var("DATABASE_URL", "this_is_not_a_url"); - let config = Config::from_env_var("DATABASE_URL"); + std::env::set_var("TEST_DATABASE_URL_INVALID", "this_is_not_a_url"); + let config = Config::from_env_var("TEST_DATABASE_URL_INVALID"); assert!(config.is_err()); } } diff --git a/refinery_core/src/drivers/config.rs b/refinery_core/src/drivers/config.rs index 9a9067ba..3f1cfd74 100644 --- a/refinery_core/src/drivers/config.rs +++ b/refinery_core/src/drivers/config.rs @@ -1,16 +1,21 @@ +use crate::config::Config; +use crate::traits::r#async::{AsyncQuery, AsyncTransaction}; +use crate::traits::sync::{Query, Transaction}; +use crate::Migration; #[cfg(any( feature = "mysql", feature = "postgres", + feature = "rusqlite", feature = "tokio-postgres", - feature = "mysql_async" + feature = "mysql_async", + feature = "tiberius-config" ))] -use crate::config::build_db_url; -use crate::config::{Config, ConfigDbType}; -use crate::error::WrapMigrationError; -use crate::traits::r#async::{AsyncQuery, AsyncTransaction}; -use crate::traits::sync::{Query, Transaction}; -use crate::traits::{GET_APPLIED_MIGRATIONS_QUERY, GET_LAST_APPLIED_MIGRATION_QUERY}; -use crate::{Error, Migration, Report, Target}; +use crate::{ + config::ConfigDbType, + error::WrapMigrationError, + traits::{GET_APPLIED_MIGRATIONS_QUERY, GET_LAST_APPLIED_MIGRATION_QUERY}, + Error, Report, Target, +}; use async_trait::async_trait; use std::convert::Infallible; @@ -63,7 +68,7 @@ macro_rules! with_connection { ConfigDbType::Mysql => { cfg_if::cfg_if! { if #[cfg(feature = "mysql")] { - let url = build_db_url("mysql", &$config); + let url = crate::config::build_db_url("mysql", &$config); let opts = mysql::Opts::from_url(&url).migration_err("could not parse url", None)?; let conn = mysql::Conn::new(opts).migration_err("could not connect to database", None)?; $op(conn) @@ -87,7 +92,7 @@ macro_rules! with_connection { ConfigDbType::Postgres => { cfg_if::cfg_if! { if #[cfg(feature = "postgres")] { - let path = build_db_url("postgresql", &$config); + let path = crate::config::build_db_url("postgresql", &$config); let conn; if $config.use_tls() { @@ -123,7 +128,7 @@ macro_rules! with_connection_async { ConfigDbType::Mysql => { cfg_if::cfg_if! { if #[cfg(feature = "mysql_async")] { - let url = build_db_url("mysql", $config); + let url = crate::config::build_db_url("mysql", $config); let pool = mysql_async::Pool::from_url(&url).migration_err("could not connect to the database", None)?; $op(pool).await } else { @@ -137,7 +142,7 @@ macro_rules! with_connection_async { ConfigDbType::Postgres => { cfg_if::cfg_if! { if #[cfg(feature = "tokio-postgres")] { - let path = build_db_url("postgresql", $config); + let path = crate::config::build_db_url("postgresql", $config); if $config.use_tls() { let connector = native_tls::TlsConnector::new().unwrap(); let connector = postgres_native_tls::MakeTlsConnector::new(connector); From 572a1f56de5d25bbbb8f93790df468fc9fc1811c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 10 Oct 2025 16:32:12 +0100 Subject: [PATCH 47/64] prepare 0.9.0 (#402) --- CHANGELOG.md | 18 ++++++++++++++++++ examples/Cargo.toml | 1 + refinery/Cargo.toml | 6 +++--- refinery_cli/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 2 +- refinery_macros/Cargo.toml | 4 ++-- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 254618a9..f88530e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.0] - 2025-01-06 +### Added +- Support for TLS in postgres/tokio-postgres using native-tls. [#353](https://github.com/rust-db/refinery/pull/353) +- Support for int8 migration versions via new `int8-versions` feature. [#330](https://github.com/rust-db/refinery/pull/330) +- Derive Serialize for Migration if serde is enabled. [#395](https://github.com/rust-db/refinery/pull/395) + +### Changed +- Update migrate Transaction and AsyncTransaction execute functions to avoid double iteration. [#393](https://github.com/rust-db/refinery/pull/393) +- Update `mysql_async` to support up until version 0.36. [#400](https://github.com/rust-db/refinery/pull/400) +- Update `rusqlite` to support up until version 0.37. [#389](https://github.com/rust-db/refinery/pull/389), [#390](https://github.com/rust-db/refinery/pull/390) +- Update `thiserror` to version 2. [#372](https://github.com/rust-db/refinery/pull/372) +- Update MSRV (Minimum Supported Rust Version). [#401](https://github.com/rust-db/refinery/pull/401), [#362](https://github.com/rust-db/refinery/pull/362) +- Fix unused warnings [#403](https://github.com/rust-db/refinery/pull/401) + + +### Fixed +- Fix logging output for async and sync migrate functions. [#378](https://github.com/rust-db/refinery/pull/378) + ## [0.8.16] - 2024-02-21 ### Fixed - Revert [#346](https://github.com/rust-db/refinery/pull/346) as it breaks Semver, save it for a minor release in the future. diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 69635967..48ec0a05 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -7,6 +7,7 @@ license = "MIT OR Apache-2.0" documentation = "https://docs.rs/refinery/" repository = "https://github.com/rust-db/refinery" edition = "2021" +publish = false [features] enums = ["refinery/enums"] diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 4e21892c..f55f0c60 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery" -version = "0.8.16" +version = "0.9.0" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" description = "Powerful SQL migration toolkit for Rust" @@ -27,8 +27,8 @@ enums = ["refinery-macros/enums"] int8-versions = ["refinery-core/int8-versions", "refinery-macros/int8-versions"] [dependencies] -refinery-core = { version = "0.8.16", path = "../refinery_core" } -refinery-macros = { version = "0.8.16", path = "../refinery_macros" } +refinery-core = { version = "0.9.0", path = "../refinery_core" } +refinery-macros = { version = "0.9.0", path = "../refinery_macros" } [dev-dependencies] barrel = { git = "https://github.com/jxs/barrel", features = ["sqlite3", "pg", "mysql", "mssql"] } diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index 6289ff48..e51ac49f 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery_cli" -version = "0.8.16" +version = "0.9.0" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT OR Apache-2.0" description = "Provides the CLI for the Refinery crate" @@ -24,7 +24,7 @@ mssql = ["refinery-core/tiberius-config", "tokio"] int8-versions = ["refinery-core/int8-versions"] [dependencies] -refinery-core = { version = "0.8.16", path = "../refinery_core", default-features = false, features = ["toml"] } +refinery-core = { version = "0.9.0", path = "../refinery_core", default-features = false, features = ["toml"] } clap = { version = "4", features = ["derive"] } human-panic = "2" toml = "0.8" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 4e67c30e..3fbd0fe4 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-core" -version = "0.8.16" +version = "0.9.0" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 00cc570f..f36c8fac 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-macros" -version = "0.8.16" +version = "0.9.0" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" @@ -16,7 +16,7 @@ int8-versions = ["refinery-core/int8-versions"] proc-macro = true [dependencies] -refinery-core = { version = "0.8.16", path = "../refinery_core" } +refinery-core = { version = "0.9.0", path = "../refinery_core" } quote = "1" syn = "2" proc-macro2 = "1" From 7425fb53be3bcc45650dfcb318adfb77342da0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 10 Oct 2025 16:50:14 +0100 Subject: [PATCH 48/64] replace cargo audit with cargo deny (#404) --- .github/workflows/ci.yml | 17 ++---- deny.toml | 114 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 12 deletions(-) create mode 100644 deny.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4d2ed36..581fca90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -200,17 +200,10 @@ jobs: toolchain: stable - run: cd refinery && cargo rustdoc --all-features -- -D rustdoc::broken_intra_doc_links - audit: - name: cargo-audit + cargo-deny: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Install Rust - # actions-rs/audit seems to be unmaintained and it's output doesn't give interverted tree dependencies - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - run: cargo install cargo-audit - - run: cargo audit + - uses: actions/checkout@v5 + - uses: EmbarkStudios/cargo-deny-action@v2 + with: + command: check advisories bans licenses sources diff --git a/deny.toml b/deny.toml new file mode 100644 index 00000000..ed337b01 --- /dev/null +++ b/deny.toml @@ -0,0 +1,114 @@ +# This section is considered when running `cargo deny check advisories` +# More documentation for the advisories section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html +[advisories] +# Version of the advisory config. See https://github.com/EmbarkStudios/cargo-deny/pull/611 +version = 2 +# The path where the advisory database is cloned/fetched into +db-path = "~/cargo/advisory-db" +# The url of the advisory database to use +db-urls = ["https://github.com/rustsec/advisory-db"] +# The lint level for crates that have been yanked from their source registry +yanked = "warn" +# A list of advisory IDs to ignore. Note that ignored advisories will still +# output a note when they are encountered. +ignore = [] +# Threshold for security vulnerabilities, any vulnerability with a CVSS score +# lower than the range specified will be ignored. Note that ignored advisories +# will still output a note when they are encountered. +# * None - CVSS Score 0.0 +# * Low - CVSS Score 0.1 - 3.9 +# * Medium - CVSS Score 4.0 - 6.9 +# * High - CVSS Score 7.0 - 8.9 +# * Critical - CVSS Score 9.0 - 10.0 +#severity-threshold = + +# This section is considered when running `cargo deny check licenses` +# More documentation for the licenses section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html +[licenses] +# Version of the license config. See https://github.com/EmbarkStudios/cargo-deny/pull/611 +version = 2 +# List of explicitly allowed licenses +# See https://spdx.org/licenses/ for list of possible licenses +# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. +allow = [ + "Apache-2.0 WITH LLVM-exception", + "Apache-2.0", + "BSD-2-Clause", + "BSD-3-Clause", + "MIT", + "Unlicense", + "Unicode-3.0", + "Zlib", +] +# The confidence threshold for detecting a license from license text. +# The higher the value, the more closely the license text must be to the +# canonical license text of a valid SPDX license file. +# [possible values: any between 0.0 and 1.0]. +confidence-threshold = 0.8 +# Allow 1 or more licenses on a per-crate basis, so that particular licenses +# aren't accepted for every possible crate as with the normal allow list +exceptions = [] + +# Some crates don't have (easily) machine readable licensing information, +# adding a clarification entry for it allows you to manually specify the +# licensing information +[[licenses.clarify]] +name = "ring" +expression = "ISC AND MIT AND OpenSSL" +license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }] + +[licenses.private] +# If true, ignores workspace crates that aren't published, or are only +# published to private registries +ignore = false +# One or more private registries that you might publish crates to, if a crate +# is only published to private registries, and ignore is true, the crate will +# not have its license(s) checked +#registries = [ +#] + +# This section is considered when running `cargo deny check bans`. +# More documentation about the 'bans' section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html +[bans] +# Lint level for when multiple versions of the same crate are detected +multiple-versions = "warn" +# The graph highlighting used when creating dotgraphs for crates +# with multiple versions +# * lowest-version - The path to the lowest versioned duplicate is highlighted +# * simplest-path - The path to the version with the fewest edges is highlighted +# * all - Both lowest-version and simplest-path are used +highlight = "all" +# List of crates that are allowed. Use with care! +#allow = [ +#] +# List of crates to deny +#deny = [ +#] +# Certain crates/versions that will be skipped when doing duplicate detection. +#skip = [ +#] +# Similarly to `skip` allows you to skip certain crates during duplicate +# detection. Unlike skip, it also includes the entire tree of transitive +# dependencies starting at the specified crate, up to a certain depth, which is +# by default infinite +#skip-tree = [ +#] + +# This section is considered when running `cargo deny check sources`. +# More documentation about the 'sources' section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html +[sources] +# Lint level for what to happen when a crate from a crate registry that is not +# in the allow list is encountered +unknown-registry = "deny" +# Lint level for what to happen when a crate from a git repository that is not +# in the allow list is encountered +unknown-git = "deny" +# List of URLs for allowed crate registries. Defaults to the crates.io index +# if not specified. If it is specified but empty, no registries are allowed. +allow-registry = ["https://github.com/rust-lang/crates.io-index"] +# List of URLs for allowed Git repositories +allow-git = ["https://github.com/jxs/barrel"] From 98733135e6b19becdaa21eca6687e8840363d032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Mon, 13 Oct 2025 11:12:41 +0100 Subject: [PATCH 49/64] version Cargo.lock (#405) --- .gitignore | 1 - Cargo.lock | 2814 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2814 insertions(+), 1 deletion(-) create mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index b1954ea8..afe783d8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ # This is refinery specific things Refinery.toml target/ -Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..d367c545 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2814 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +dependencies = [ + "windows-sys 0.60.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.60.2", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "assert_cmd" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd389a4b2970a01282ee455294913c0a43724daedcd1a24c3eb0ec1c1320b66" +dependencies = [ + "anstyle", + "bstr", + "doc-comment", + "libc", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "asynchronous-codec" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-link", +] + +[[package]] +name = "barrel" +version = "0.6.6-alpha.0" +source = "git+https://github.com/jxs/barrel#0221f547be69ebca584da750c6b19a8582ce9548" + +[[package]] +name = "barrel" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad9e605929a6964efbec5ac0884bd0fe93f12a3b1eb271f52c251316640c68d9" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "btoi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd6407f73a9b8b6162d8a2ef999fe6afd7cc15902ebf42c5cd296addf17e0ad" +dependencies = [ + "num-traits", +] + +[[package]] +name = "bufstream" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8" + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cc" +version = "1.2.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d05d92f4b1fd76aad469d46cdd858ca761576082cd37df81416691e50199fb" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + +[[package]] +name = "clap" +version = "4.5.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "connection-string" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "510ca239cf13b7f8d16a2b48f263de7b4f8c566f0af58d901031473c76afb1e3" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "deranged" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "derive_utils" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccfae181bab5ab6c5478b2ccb69e4c68a02f8c3ec72f6616bfec9dbc599d2ee0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "env_filter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0399f9d26e5191ce32c498bebd31e7a3ceabc2745f0ac54af3f335126c3f24b3" + +[[package]] +name = "flate2" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5a4e564e38c699f2880d3fda590bedc2e69f3f84cd48b457bd892ce61d0aa9" +dependencies = [ + "crc32fast", + "libz-sys", + "miniz_oxide", +] + +[[package]] +name = "float-cmp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8" +dependencies = [ + "num-traits", +] + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.7+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "human-panic" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac63a746b187e95d51fe16850eb04d1cfef203f6af98e6c405a6f262ad3df00a" +dependencies = [ + "anstream", + "anstyle", + "backtrace", + "os_info", + "serde", + "serde_derive", + "toml 0.9.7", + "uuid", +] + +[[package]] +name = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +dependencies = [ + "equivalent", + "hashbrown 0.16.0", +] + +[[package]] +name = "io-enum" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d197db2f7ebf90507296df3aebaf65d69f5dce8559d8dbd82776a6cadab61bbf" +dependencies = [ + "derive_utils", +] + +[[package]] +name = "io-uring" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jiff" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "js-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "keyed_priority_queue" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee7893dab2e44ae5f9d0173f26ff4aa327c10b01b06a72b52dd9405b628640d" +dependencies = [ + "indexmap", +] + +[[package]] +name = "libc" +version = "0.2.176" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" + +[[package]] +name = "libredox" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +dependencies = [ + "bitflags", + "libc", + "redox_syscall", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" + +[[package]] +name = "lru" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f8cc7106155f10bdf99a6f379688f543ad6596a415375b36a59a054ceda1198" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "mysql" +version = "26.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2510a735f601bab18202b07ea0a197bd1d130d3a5ce2edf4577d225f0c3ee4" +dependencies = [ + "bufstream", + "bytes", + "crossbeam-queue", + "crossbeam-utils", + "flate2", + "io-enum", + "libc", + "lru 0.12.5", + "mysql_common", + "named_pipe", + "pem", + "percent-encoding", + "socket2 0.5.10", + "twox-hash", + "url", +] + +[[package]] +name = "mysql_async" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "277ce2f2459b2af4cc6d0a0b7892381f80800832f57c533f03e2845f4ea331ea" +dependencies = [ + "bytes", + "crossbeam-queue", + "flate2", + "futures-core", + "futures-sink", + "futures-util", + "keyed_priority_queue", + "lru 0.14.0", + "mysql_common", + "pem", + "percent-encoding", + "rand", + "serde", + "serde_json", + "socket2 0.5.10", + "thiserror 2.0.17", + "tokio", + "tokio-util", + "twox-hash", + "url", +] + +[[package]] +name = "mysql_common" +version = "0.35.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbb9f371618ce723f095c61fbcdc36e8936956d2b62832f9c7648689b338e052" +dependencies = [ + "base64", + "bitflags", + "btoi", + "byteorder", + "bytes", + "crc32fast", + "flate2", + "getrandom", + "num-bigint", + "num-traits", + "regex", + "saturating", + "serde", + "serde_json", + "sha1", + "sha2", + "thiserror 2.0.17", + "uuid", +] + +[[package]] +name = "named_pipe" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad9c443cce91fc3e12f017290db75dde490d685cdaaf508d7159d7cf41f0eb2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "openssl" +version = "0.10.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_info" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0e1ac5fde8d43c34139135df8ea9ee9465394b2d8d20f032d38998f64afffc3" +dependencies = [ + "log", + "plist", + "serde", + "windows-sys 0.52.0", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "pem" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38af38e8470ac9dee3ce1bae1af9c1671fffc44ddfd8bd1d0a3445bf349a8ef3" +dependencies = [ + "base64", + "serde", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_shared", + "serde", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "plist" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" +dependencies = [ + "base64", + "indexmap", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "postgres" +version = "0.19.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c48ece1c6cda0db61b058c1721378da76855140e9214339fa1317decacb176" +dependencies = [ + "bytes", + "fallible-iterator 0.2.0", + "futures-util", + "log", + "tokio", + "tokio-postgres", +] + +[[package]] +name = "postgres-native-tls" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac73153d92e4bde922bd6f1dfba7f1ab8132266c031153b55e20a1521cd36d49" +dependencies = [ + "native-tls", + "tokio", + "tokio-native-tls", + "tokio-postgres", +] + +[[package]] +name = "postgres-protocol" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbef655056b916eb868048276cfd5d6a7dea4f81560dfd047f97c8c6fe3fcfd4" +dependencies = [ + "base64", + "byteorder", + "bytes", + "fallible-iterator 0.2.0", + "hmac", + "md-5", + "memchr", + "rand", + "sha2", + "stringprep", +] + +[[package]] +name = "postgres-types" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4605b7c057056dd35baeb6ac0c0338e4975b1f2bef0f65da953285eb007095" +dependencies = [ + "bytes", + "fallible-iterator 0.2.0", + "postgres-protocol", +] + +[[package]] +name = "potential_utf" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "predicates" +version = "3.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" +dependencies = [ + "anstyle", + "difflib", + "float-cmp", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" + +[[package]] +name = "predicates-tree" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "pretty-hex" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.38.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a232e7487fc2ef313d96dde7948e7a3c05101870d8985e4fd8d26aedd27b89" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "refinery" +version = "0.9.0" +dependencies = [ + "assert_cmd", + "barrel 0.6.6-alpha.0", + "futures", + "predicates", + "refinery-core", + "refinery-macros", + "tempfile", + "time", + "tokio", + "tokio-util", +] + +[[package]] +name = "refinery-core" +version = "0.9.0" +dependencies = [ + "async-trait", + "barrel 0.6.6-alpha.0", + "cfg-if", + "futures", + "log", + "mysql", + "mysql_async", + "native-tls", + "postgres", + "postgres-native-tls", + "regex", + "rusqlite", + "serde", + "siphasher", + "tempfile", + "thiserror 2.0.17", + "tiberius", + "time", + "tokio", + "tokio-postgres", + "tokio-util", + "toml 0.8.23", + "url", + "walkdir", +] + +[[package]] +name = "refinery-examples" +version = "0.8.12" +dependencies = [ + "barrel 0.7.0", + "env_logger", + "log", + "refinery", + "rusqlite", +] + +[[package]] +name = "refinery-macros" +version = "0.9.0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "refinery-core", + "regex", + "syn", + "tempfile", +] + +[[package]] +name = "refinery_cli" +version = "0.9.0" +dependencies = [ + "anyhow", + "assert_cmd", + "cfg-if", + "clap", + "env_logger", + "human-panic", + "log", + "predicates", + "refinery-core", + "regex", + "tokio", + "toml 0.8.23", + "walkdir", +] + +[[package]] +name = "regex" +version = "1.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" + +[[package]] +name = "rusqlite" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f" +dependencies = [ + "bitflags", + "fallible-iterator 0.3.0", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "saturating" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71" + +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" +dependencies = [ + "serde_core", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tempfile" +version = "3.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +dependencies = [ + "fastrand", + "getrandom", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "termtree" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tiberius" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1446cb4198848d1562301a3340424b4f425ef79f35ef9ee034769a9dd92c10d" +dependencies = [ + "async-trait", + "asynchronous-codec", + "byteorder", + "bytes", + "connection-string", + "encoding_rs", + "enumflags2", + "futures-util", + "num-traits", + "once_cell", + "pin-project-lite", + "pretty-hex", + "thiserror 1.0.69", + "tracing", + "uuid", +] + +[[package]] +name = "time" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +dependencies = [ + "backtrace", + "bytes", + "io-uring", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "slab", + "socket2 0.6.0", + "tokio-macros", + "windows-sys 0.59.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-postgres" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b40d66d9b2cfe04b628173409368e58247e8eddbbd3b0e6c6ba1d09f20f6c9e" +dependencies = [ + "async-trait", + "byteorder", + "bytes", + "fallible-iterator 0.2.0", + "futures-channel", + "futures-util", + "log", + "parking_lot", + "percent-encoding", + "phf", + "pin-project-lite", + "postgres-protocol", + "postgres-types", + "rand", + "socket2 0.6.0", + "tokio", + "tokio-util", + "whoami", +] + +[[package]] +name = "tokio-util" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_edit", +] + +[[package]] +name = "toml" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" +dependencies = [ + "serde_core", + "serde_spanned 1.0.2", + "toml_datetime 0.7.2", + "toml_writer", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "toml_writer" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "twox-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "getrandom", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.7+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +dependencies = [ + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "whoami" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" +dependencies = [ + "libredox", + "wasite", + "web-sys", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] From 3abf61ec3836e835012346336fe144ca7fe9e9b7 Mon Sep 17 00:00:00 2001 From: Youser Nayme <51252915+NeuralModder@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:33:27 +0000 Subject: [PATCH 50/64] Support rusqlite 0.38.x (#410) Co-authored-by: Youser Nayme <7685106-NeuralModder@users.noreply.gitlab.com> --- examples/Cargo.toml | 2 +- refinery_core/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 48ec0a05..90f496a7 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -15,7 +15,7 @@ int8-versions = ["refinery/int8-versions"] [dependencies] refinery = { path = "../refinery", features = ["rusqlite"] } -rusqlite = "0.37" +rusqlite = "0.38" barrel = { version = "0.7", features = ["sqlite3"] } log = "0.4" env_logger = "0.11" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 3fbd0fe4..7691ae69 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -31,7 +31,7 @@ url = "2.0" walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar -rusqlite = { version = ">= 0.23, <= 0.37", optional = true } +rusqlite = { version = ">= 0.23, <= 0.38", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } native-tls = { version = "0.2", optional = true } postgres-native-tls = { version = "0.5", optional = true} From 8f0f9d39176cd1eb2640995ba7d6189eb6472fbb Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 25 Mar 2026 07:03:57 -0500 Subject: [PATCH 51/64] Allow disabling Config for postgres and tokio-postgres (#408) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allow disabling Config for postgres and tokio-postgres * Fix building refinery_cli with no deault features * Enable config for refinery features * Add config to tiberius-config * Make tls opt-in rather than opt-out * Use postgres-tls in cli * Test postgres + tls --------- Co-authored-by: João Oliveira --- .github/workflows/ci.yml | 6 +++--- refinery/Cargo.toml | 17 ++++++++++------- refinery/src/lib.rs | 1 + refinery_cli/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 17 +++++++++++------ refinery_core/src/drivers/mod.rs | 1 + refinery_core/src/lib.rs | 1 + 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 581fca90..c5528055 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,8 +97,8 @@ jobs: with: toolchain: ${{ matrix.rust }} - run: cargo install --path ./refinery_cli --no-default-features --features=postgresql - - run: cd refinery && cargo test --features postgres --test postgres -- --test-threads 1 - - run: cd refinery && cargo test --features postgres,int8-versions --test postgres -- --test-threads 1 + - run: cd refinery && cargo test --features postgres-tls --test postgres -- --test-threads 1 + - run: cd refinery && cargo test --features postgres-tls,int8-versions --test postgres -- --test-threads 1 test-tokio-postgres: name: Test tokio-postgres @@ -117,7 +117,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} - - run: cd refinery && cargo test --features tokio-postgres --test tokio_postgres -- --test-threads 1 + - run: cd refinery && cargo test --features tokio-postgres-tls --test tokio_postgres -- --test-threads 1 test-mysql: name: Test mysql diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index f55f0c60..1218459b 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -13,21 +13,24 @@ edition = "2018" [features] default = ["toml"] -rusqlite-bundled = ["refinery-core/rusqlite-bundled"] -rusqlite = ["refinery-core/rusqlite"] +config = ["refinery-core/config"] +rusqlite-bundled = ["refinery-core/rusqlite-bundled", "config"] +rusqlite = ["refinery-core/rusqlite", "config"] +postgres-tls = ["refinery-core/postgres-tls", "config"] postgres = ["refinery-core/postgres"] -mysql = ["refinery-core/mysql"] +mysql = ["refinery-core/mysql", "config"] +tokio-postgres-tls = ["refinery-core/tokio-postgres-tls", "config"] tokio-postgres = ["refinery-core/tokio-postgres"] -mysql_async = ["refinery-core/mysql_async"] -tiberius = ["refinery-core/tiberius"] -tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config"] +mysql_async = ["refinery-core/mysql_async", "config"] +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"] 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_cli/Cargo.toml b/refinery_cli/Cargo.toml index e51ac49f..127bcc97 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -16,7 +16,7 @@ path = "src/main.rs" [features] default = ["mysql", "postgresql", "sqlite-bundled", "mssql"] -postgresql = ["refinery-core/postgres"] +postgresql = ["refinery-core/postgres-tls"] mysql = ["refinery-core/mysql"] sqlite = ["refinery-core/rusqlite"] sqlite-bundled = ["sqlite", "refinery-core/rusqlite-bundled"] @@ -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" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 7691ae69..24ec6361 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 = [ "dep:postgres" ] +postgres-tls = ["postgres", "dep:postgres-native-tls", "tls", "config"] +rusqlite = ["dep:rusqlite", "config"] +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 = ["dep:tokio-postgres", "dep:tokio", "tokio/rt"] +tokio-postgres-tls = ["tokio-postgres", "postgres-tls", "config"] toml = ["serde", "dep:toml"] int8-versions = [] diff --git a/refinery_core/src/drivers/mod.rs b/refinery_core/src/drivers/mod.rs index 867d4c4d..12688c67 100644 --- a/refinery_core/src/drivers/mod.rs +++ b/refinery_core/src/drivers/mod.rs @@ -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..a6230f84 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; From 01b19733368aba8802cc3d20b8e72fa79867ea34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Wed, 25 Mar 2026 12:47:40 +0000 Subject: [PATCH 52/64] update deps to address cargo-deny (#418) --- Cargo.lock | 76 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d367c545..218c15d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -221,9 +221,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.10.1" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cc" @@ -531,6 +531,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "foreign-types" version = "0.3.2" @@ -680,22 +686,25 @@ checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.1.5", ] [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "foldhash 0.2.0", +] [[package]] name = "hashlink" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +checksum = "ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230" dependencies = [ - "hashbrown 0.15.5", + "hashbrown 0.16.1", ] [[package]] @@ -843,7 +852,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", - "hashbrown 0.16.0", + "hashbrown 0.15.5", ] [[package]] @@ -940,9 +949,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f" +checksum = "95b4103cffefa72eb8428cb6b47d6627161e51c2739fc5e3b734584157bc642a" dependencies = [ "cc", "pkg-config", @@ -1160,9 +1169,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" [[package]] name = "num-integer" @@ -1667,11 +1676,21 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +[[package]] +name = "rsqlite-vfs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a1f2315036ef6b1fbacd1972e8ee7688030b0a2121edfc2a6550febd41574d" +dependencies = [ + "hashbrown 0.16.1", + "thiserror 2.0.17", +] + [[package]] name = "rusqlite" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f" +checksum = "f1c93dd1c9683b438c392c492109cb702b8090b2bfc8fed6f6e4eb4523f17af3" dependencies = [ "bitflags", "fallible-iterator 0.3.0", @@ -1679,6 +1698,7 @@ dependencies = [ "hashlink", "libsqlite3-sys", "smallvec", + "sqlite-wasm-rs", ] [[package]] @@ -1907,6 +1927,18 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "sqlite-wasm-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4206ed3a67690b9c29b77d728f6acc3ce78f16bf846d83c94f76400320181b" +dependencies = [ + "cc", + "js-sys", + "rsqlite-vfs", + "wasm-bindgen", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -2042,30 +2074,30 @@ dependencies = [ [[package]] name = "time" -version = "0.3.44" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.24" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", From 1a75c690b105724bf3bb3539cb16e65bebef1db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Fri, 27 Mar 2026 11:04:34 +0000 Subject: [PATCH 53/64] add action to close stale issues and PRs (#419) --- .github/workflows/stale.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..71c2556c --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,17 @@ +name: Close stale issues + +on: + schedule: + - cron: '0 0 * * *' # runs daily at midnight + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v10 + with: + days-before-stale: 30 + days-before-close: 7 + stale-issue-message: 'This issue has been automatically marked as stale due to inactivity.' + close-issue-message: 'Closing this issue due to prolonged inactivity.' + exempt-issue-labels: 'keep-open' From 87092c90b42c9f148174fca314eacaa0c42d84ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Sun, 29 Mar 2026 11:04:34 +0100 Subject: [PATCH 54/64] address assert_cmd::cargo_bin deprecation (#420) --- Cargo.lock | 11 ++--------- refinery_cli/tests/cli.rs | 14 +++++++------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 218c15d3..c57c565a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -90,13 +90,12 @@ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "assert_cmd" -version = "2.0.17" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd389a4b2970a01282ee455294913c0a43724daedcd1a24c3eb0ec1c1320b66" +checksum = "9a686bbee5efb88a82df0621b236e74d925f470e5445d3220a5648b892ec99c9" dependencies = [ "anstyle", "bstr", - "doc-comment", "libc", "predicates", "predicates-core", @@ -401,12 +400,6 @@ dependencies = [ "syn", ] -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - [[package]] name = "encoding_rs" version = "0.8.35" diff --git a/refinery_cli/tests/cli.rs b/refinery_cli/tests/cli.rs index 863f0787..502a6adf 100644 --- a/refinery_cli/tests/cli.rs +++ b/refinery_cli/tests/cli.rs @@ -6,14 +6,15 @@ mod cli { // `refinery` with no args should exit with a non-zero code. #[test] fn cli_no_args() { - Command::cargo_bin("refinery").unwrap().assert().failure(); + Command::new(assert_cmd::cargo_bin!("refinery")) + .assert() + .failure(); } #[test] fn cli_version() { - Command::cargo_bin("refinery") - .unwrap() - .args(["-V"]) + Command::new(assert_cmd::cargo_bin!("refinery")) + .arg("-V") .assert() .stdout(contains(env!("CARGO_PKG_VERSION"))); } @@ -21,9 +22,8 @@ mod cli { // `refinery migrate` with no args should exit with a non-zero code. #[test] fn migrate_no_args() { - Command::cargo_bin("refinery") - .unwrap() - .args(["migrate"]) + Command::new(assert_cmd::cargo_bin!("refinery")) + .arg("migrate") .assert() .failure(); } From ff809c82dbf51655373aa31594aaa6e6a488e69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Sun, 29 Mar 2026 15:08:52 +0100 Subject: [PATCH 55/64] do not log warning on nested dirs when finding migrations (#421) --- refinery_core/src/util.rs | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/refinery_core/src/util.rs b/refinery_core/src/util.rs index 64c43889..d19f167f 100644 --- a/refinery_core/src/util.rs +++ b/refinery_core/src/util.rs @@ -87,8 +87,12 @@ pub fn find_migration_files( .filter_map(Result::ok) .map(DirEntry::into_path) // filter by migration file regex - .filter( - move |entry| match entry.file_name().and_then(OsStr::to_str) { + .filter(move |entry| { + if entry.is_dir() { + return false; + } + + match entry.file_name().and_then(OsStr::to_str) { Some(file_name) if re.is_match(file_name) => true, Some(file_name) => { log::warn!( @@ -98,8 +102,8 @@ pub fn find_migration_files( false } None => false, - }, - ); + } + }); Ok(file_paths) } @@ -193,6 +197,28 @@ mod tests { assert_eq!(sql2.canonicalize().unwrap(), mods[1]); } + #[test] + fn finds_sql_migrations_in_nested_directories() { + let tmp_dir = TempDir::new().unwrap(); + let migrations_dir = tmp_dir.path().join("migrations"); + let nested_dir = migrations_dir.join("foo"); + fs::create_dir(&migrations_dir).unwrap(); + fs::create_dir(&nested_dir).unwrap(); + + let sql1 = nested_dir.join("V1__first.sql"); + let sql2 = nested_dir.join("V2__second.sql"); + fs::File::create(&sql1).unwrap(); + fs::File::create(&sql2).unwrap(); + + let mut mods: Vec = find_migration_files(migrations_dir, MigrationType::All) + .unwrap() + .collect(); + mods.sort(); + + assert_eq!(sql1.canonicalize().unwrap(), mods[0]); + assert_eq!(sql2.canonicalize().unwrap(), mods[1]); + } + #[test] fn finds_unversioned_migrations() { let tmp_dir = TempDir::new().unwrap(); From c4f819bbbab3f67c98b4ff44a40cd83430f1172d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 16:13:58 +0100 Subject: [PATCH 56/64] Bump rand from 0.9.2 to 0.9.4 (#422) Bumps [rand](https://github.com/rust-random/rand) from 0.9.2 to 0.9.4. - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/0.9.4/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/rand_core-0.9.2...0.9.4) --- updated-dependencies: - dependency-name: rand dependency-version: 0.9.4 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c57c565a..f764723e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1515,9 +1515,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "rand" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" dependencies = [ "rand_chacha", "rand_core", From fc7848f281c17863dabaad04aec3430ca69784fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 15:03:16 +0100 Subject: [PATCH 57/64] Bump openssl from 0.10.73 to 0.10.78 (#427) Bumps [openssl](https://github.com/rust-openssl/rust-openssl) from 0.10.73 to 0.10.78. - [Release notes](https://github.com/rust-openssl/rust-openssl/releases) - [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-v0.10.73...openssl-v0.10.78) --- updated-dependencies: - dependency-name: openssl dependency-version: 0.10.78 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f764723e..dc8db774 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1207,9 +1207,9 @@ checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "openssl" -version = "0.10.73" +version = "0.10.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +checksum = "f38c4372413cdaaf3cc79dd92d29d7d9f5ab09b51b10dded508fb90bb70b9222" dependencies = [ "bitflags", "cfg-if", @@ -1239,9 +1239,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" -version = "0.9.109" +version = "0.9.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +checksum = "13ce1245cd07fcc4cfdb438f7507b0c7e4f3849a69fd84d52374c66d83741bb6" dependencies = [ "cc", "libc", From f4b23ea271d267181280f8ddca98130245b83d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Olveck=C3=BD?= Date: Fri, 24 Apr 2026 14:21:43 +0000 Subject: [PATCH 58/64] chore: Support rusqlite 0.39.x (#425) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: João Oliveira --- Cargo.lock | 8 ++++---- examples/Cargo.toml | 2 +- refinery_core/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dc8db774..091f011d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -942,9 +942,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b4103cffefa72eb8428cb6b47d6627161e51c2739fc5e3b734584157bc642a" +checksum = "b1f111c8c41e7c61a49cd34e44c7619462967221a6443b0ec299e0ac30cfb9b1" dependencies = [ "cc", "pkg-config", @@ -1681,9 +1681,9 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c93dd1c9683b438c392c492109cb702b8090b2bfc8fed6f6e4eb4523f17af3" +checksum = "a0d2b0146dd9661bf67bb107c0bb2a55064d556eeb3fc314151b957f313bcd4e" dependencies = [ "bitflags", "fallible-iterator 0.3.0", diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 90f496a7..e70f1d92 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -15,7 +15,7 @@ int8-versions = ["refinery/int8-versions"] [dependencies] refinery = { path = "../refinery", features = ["rusqlite"] } -rusqlite = "0.38" +rusqlite = "0.39" barrel = { version = "0.7", features = ["sqlite3"] } log = "0.4" env_logger = "0.11" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 24ec6361..4ef3c851 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -36,7 +36,7 @@ url = "2.0" walkdir = "2.3.1" # allow multiple versions of the same dependency if API is similar -rusqlite = { version = ">= 0.23, <= 0.38", optional = true } +rusqlite = { version = ">= 0.23, <= 0.39", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } native-tls = { version = "0.2", optional = true } postgres-native-tls = { version = "0.5", optional = true} From 6074795da7b046e48d897d72aee16b4c8f3f863f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Olveck=C3=BD?= Date: Mon, 27 Apr 2026 13:43:32 +0000 Subject: [PATCH 59/64] Allow running `tokio-postgres` with `rustls` (#426) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(core): guard native-tls usage with tls feature flag When tokio-postgres or postgres features are enabled without the tls feature, config.rs still referenced native_tls and postgres_native_tls crates that are no longer pulled in. Guard those code paths with #[cfg(feature = "tls")] so that no-TLS builds do not require openssl. Co-Authored-By: Claude Sonnet 4.6 * fix(core): panic when TLS requested but tls feature not enabled Instead of silently falling back to an unencrypted connection when use_tls() is true but the 'tls' feature is disabled, panic with a clear message so the misconfiguration is immediately visible. Co-Authored-By: Claude Sonnet 4.6 * feat(core): add tokio-postgres-rustls feature for rustls TLS support Adds a new `tokio-postgres-rustls` feature to refinery/refinery-core that provides TLS for the config-based tokio-postgres connection path using rustls instead of native-tls/openssl. Design: no crypto provider is bundled. Callers must install a global provider (e.g. ring or aws-lc-rs) before running migrations with TLS. System trust roots are loaded via rustls-native-certs. When use_tls() is true but the feature is disabled, a clear panic is raised. Note: tokio-postgres-rustls 0.13 has an unconditional ring dep for certificate fingerprinting (unrelated to the TLS crypto provider). Co-Authored-By: Claude Sonnet 4.6 * chore: Update `rustls-webpki` to fix `RUSTSEC-2026-0104` * chore: Add ISC to allowed licenses * Make `tokio-postgres-*` tls features imply `tokio-postgres` * Add `tokio-postgres-rustls` test Also make postgres connection string configurable via `POSTGRES_URL` environment variable. * style: Format sources --------- Co-authored-by: Claude Sonnet 4.6 Co-authored-by: João Oliveira --- .github/workflows/ci.yml | 1 + Cargo.lock | 1490 ++++++++++++++++++--------- deny.toml | 1 + refinery/Cargo.toml | 4 +- refinery/tests/tokio_postgres.rs | 123 ++- refinery_core/Cargo.toml | 4 + refinery_core/src/drivers/config.rs | 101 +- 7 files changed, 1167 insertions(+), 557 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5528055..704fd971 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,6 +118,7 @@ jobs: with: toolchain: ${{ matrix.rust }} - run: cd refinery && cargo test --features tokio-postgres-tls --test tokio_postgres -- --test-threads 1 + - run: cd refinery && cargo test --features tokio-postgres-rustls --test tokio_postgres -- --test-threads 1 test-mysql: name: Test mysql diff --git a/Cargo.lock b/Cargo.lock index 091f011d..e30e6168 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -34,9 +34,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "anstream" -version = "0.6.21" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", @@ -49,50 +49,50 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" -version = "0.2.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "anyhow" -version = "1.0.100" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "assert_cmd" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a686bbee5efb88a82df0621b236e74d925f470e5445d3220a5648b892ec99c9" +checksum = "39bae1d3fa576f7c6519514180a72559268dd7d1fe104070956cb687bc6673bd" dependencies = [ "anstyle", "bstr", @@ -165,11 +165,17 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + [[package]] name = "bitflags" -version = "2.9.4" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" [[package]] name = "block-buffer" @@ -180,11 +186,20 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" +dependencies = [ + "hybrid-array", +] + [[package]] name = "bstr" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" dependencies = [ "memchr", "regex-automata", @@ -208,9 +223,9 @@ checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8" [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "byteorder" @@ -226,9 +241,9 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cc" -version = "1.2.40" +version = "1.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d05d92f4b1fd76aad469d46cdd858ca761576082cd37df81416691e50199fb" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" dependencies = [ "find-msvc-tools", "shlex", @@ -236,15 +251,26 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chacha20" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] [[package]] name = "clap" -version = "4.5.48" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" dependencies = [ "clap_builder", "clap_derive", @@ -252,9 +278,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.48" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ "anstream", "anstyle", @@ -264,9 +290,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.47" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" dependencies = [ "heck", "proc-macro2", @@ -276,15 +302,21 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.5" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "cmov" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" +checksum = "3f88a43d011fc4a6876cb7344703e297c71dda42494fee094d5f7c76bf13f746" [[package]] name = "colorchoice" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "connection-string" @@ -292,11 +324,23 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "510ca239cf13b7f8d16a2b48f263de7b4f8c566f0af58d901031473c76afb1e3" +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", "libc", @@ -317,6 +361,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -343,19 +396,60 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "typenum", ] +[[package]] +name = "crypto-common" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ctutils" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e" +dependencies = [ + "cmov", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid 0.9.6", + "der_derive", + "flagset", + "zeroize", +] + +[[package]] +name = "der_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "deranged" -version = "0.5.4" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", "serde_core", @@ -363,9 +457,9 @@ dependencies = [ [[package]] name = "derive_utils" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccfae181bab5ab6c5478b2ccb69e4c68a02f8c3ec72f6616bfec9dbc599d2ee0" +checksum = "362f47930db19fe7735f527e6595e4900316b893ebf6d48ad3d31be928d57dd6" dependencies = [ "proc-macro2", "quote", @@ -384,9 +478,20 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "crypto-common", - "subtle", + "block-buffer 0.10.4", + "crypto-common 0.1.7", +] + +[[package]] +name = "digest" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c" +dependencies = [ + "block-buffer 0.12.0", + "const-oid 0.10.2", + "crypto-common 0.2.1", + "ctutils", ] [[package]] @@ -431,9 +536,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +checksum = "32e90c2accc4b07a8456ea0debdc2e7587bdd890680d71173a15d4ae604f6eef" dependencies = [ "log", "regex", @@ -441,9 +546,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.8" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a" dependencies = [ "anstream", "anstyle", @@ -488,21 +593,27 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.3.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "find-msvc-tools" -version = "0.1.3" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flagset" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0399f9d26e5191ce32c498bebd31e7a3ceabc2745f0ac54af3f335126c3f24b3" +checksum = "b7ac824320a75a52197e8f2d787f6a38b6718bb6897a35142d749af3c0e8f4fe" [[package]] name = "flate2" -version = "1.1.4" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc5a4e564e38c699f2880d3fda590bedc2e69f3f84cd48b457bd892ce61d0aa9" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "libz-sys", @@ -556,9 +667,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -571,9 +682,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -581,15 +692,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", @@ -598,15 +709,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", @@ -615,21 +726,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -639,7 +750,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -655,14 +765,39 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.3" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "r-efi", - "wasi 0.14.7+wasi-0.2.4", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasip2", + "wasip3", ] [[package]] @@ -677,8 +812,6 @@ version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "allocator-api2", - "equivalent", "foldhash 0.1.5", ] @@ -688,9 +821,17 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ + "allocator-api2", + "equivalent", "foldhash 0.2.0", ] +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + [[package]] name = "hashlink" version = "0.11.0" @@ -708,37 +849,47 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hmac" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" dependencies = [ - "digest", + "digest 0.11.2", ] [[package]] name = "human-panic" -version = "2.0.3" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac63a746b187e95d51fe16850eb04d1cfef203f6af98e6c405a6f262ad3df00a" +checksum = "e2815d0c49773c6e0a9753960b3d0e50b822e48e08c77bcb4780be8474c9cc3d" dependencies = [ "anstream", "anstyle", "backtrace", - "os_info", "serde", "serde_derive", - "toml 0.9.7", + "sysinfo", + "toml 1.1.2+spec-1.1.0", "uuid", ] +[[package]] +name = "hybrid-array" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3944cf8cf766b40e2a1a333ee5e9b563f854d5fa49d6a8ca2764e97c6eddb214" +dependencies = [ + "typenum", +] + [[package]] name = "icu_collections" -version = "2.0.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" dependencies = [ "displaydoc", "potential_utf", + "utf8_iter", "yoke", "zerofrom", "zerovec", @@ -746,9 +897,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.0.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" dependencies = [ "displaydoc", "litemap", @@ -759,11 +910,10 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.0.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" dependencies = [ - "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", @@ -774,42 +924,38 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.0.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" [[package]] name = "icu_properties" -version = "2.0.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" dependencies = [ - "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", - "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "2.0.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" [[package]] name = "icu_provider" -version = "2.0.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" dependencies = [ "displaydoc", "icu_locale_core", - "stable_deref_trait", - "tinystr", "writeable", "yoke", "zerofrom", @@ -817,6 +963,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "idna" version = "1.1.0" @@ -840,64 +992,55 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.11.4" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown 0.15.5", + "hashbrown 0.17.0", + "serde", + "serde_core", ] [[package]] name = "io-enum" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d197db2f7ebf90507296df3aebaf65d69f5dce8559d8dbd82776a6cadab61bbf" +checksum = "7de9008599afe8527a8c9d70423437363b321649161e98473f433de802d76107" dependencies = [ "derive_utils", ] -[[package]] -name = "io-uring" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" -dependencies = [ - "bitflags", - "cfg-if", - "libc", -] - [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "jiff" -version = "0.2.15" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +checksum = "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359" dependencies = [ "jiff-static", "log", "portable-atomic", "portable-atomic-util", - "serde", + "serde_core", ] [[package]] name = "jiff-static" -version = "0.2.15" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +checksum = "2a8c8b344124222efd714b73bb41f8b5120b27a7cc1c75593a6ff768d9d05aa4" dependencies = [ "proc-macro2", "quote", @@ -906,9 +1049,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.81" +version = "0.3.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" dependencies = [ "once_cell", "wasm-bindgen", @@ -923,21 +1066,25 @@ dependencies = [ "indexmap", ] +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" -version = "0.2.176" +version = "0.2.185" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" [[package]] name = "libredox" -version = "0.1.10" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" dependencies = [ - "bitflags", "libc", - "redox_syscall", ] [[package]] @@ -953,9 +1100,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.22" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" +checksum = "fc3a226e576f50782b3305c5ccf458698f92798987f551c6a02efe8276721e22" dependencies = [ "cc", "pkg-config", @@ -964,15 +1111,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" [[package]] name = "lock_api" @@ -985,9 +1132,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lru" @@ -997,28 +1144,28 @@ checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" [[package]] name = "lru" -version = "0.14.0" +version = "0.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f8cc7106155f10bdf99a6f379688f543ad6596a415375b36a59a054ceda1198" +checksum = "7f66e8d5d03f609abc3a39e6f08e4164ebf1447a732906d39eb9b99b7919ef39" dependencies = [ - "hashbrown 0.15.5", + "hashbrown 0.16.1", ] [[package]] name = "md-5" -version = "0.10.6" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98" dependencies = [ "cfg-if", - "digest", + "digest 0.11.2", ] [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "miniz_oxide" @@ -1032,13 +1179,13 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" dependencies = [ "libc", "wasi 0.11.1+wasi-snapshot-preview1", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1066,9 +1213,9 @@ dependencies = [ [[package]] name = "mysql_async" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "277ce2f2459b2af4cc6d0a0b7892381f80800832f57c533f03e2845f4ea331ea" +checksum = "d1d9585dc9058886ff3a1f48a23024dd1d054264dee7c5ae0e4bd640c953bee5" dependencies = [ "bytes", "crossbeam-queue", @@ -1077,15 +1224,15 @@ dependencies = [ "futures-sink", "futures-util", "keyed_priority_queue", - "lru 0.14.0", + "lru 0.16.4", "mysql_common", "pem", "percent-encoding", - "rand", + "rand 0.9.4", "serde", "serde_json", "socket2 0.5.10", - "thiserror 2.0.17", + "thiserror 2.0.18", "tokio", "tokio-util", "twox-hash", @@ -1105,7 +1252,7 @@ dependencies = [ "bytes", "crc32fast", "flate2", - "getrandom", + "getrandom 0.3.4", "num-bigint", "num-traits", "regex", @@ -1113,8 +1260,8 @@ dependencies = [ "serde", "serde_json", "sha1", - "sha2", - "thiserror 2.0.17", + "sha2 0.10.9", + "thiserror 2.0.18", "uuid", ] @@ -1129,9 +1276,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.14" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" dependencies = [ "libc", "log", @@ -1150,6 +1297,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -1184,6 +1340,34 @@ dependencies = [ "autocfg", ] +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", +] + +[[package]] +name = "objc2-io-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +dependencies = [ + "libc", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-system-configuration" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396" +dependencies = [ + "objc2-core-foundation", +] + [[package]] name = "object" version = "0.37.3" @@ -1195,15 +1379,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "openssl" @@ -1233,9 +1417,9 @@ dependencies = [ [[package]] name = "openssl-probe" -version = "0.1.6" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] name = "openssl-sys" @@ -1249,18 +1433,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "os_info" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0e1ac5fde8d43c34139135df8ea9ee9465394b2d8d20f032d38998f64afffc3" -dependencies = [ - "log", - "plist", - "serde", - "windows-sys 0.52.0", -] - [[package]] name = "parking_lot" version = "0.12.5" @@ -1286,12 +1458,12 @@ dependencies = [ [[package]] name = "pem" -version = "3.0.5" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38af38e8470ac9dee3ce1bae1af9c1671fffc44ddfd8bd1d0a3445bf349a8ef3" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" dependencies = [ "base64", - "serde", + "serde_core", ] [[package]] @@ -1321,55 +1493,36 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkg-config" -version = "0.3.32" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "plist" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" -dependencies = [ - "base64", - "indexmap", - "quick-xml", - "serde", - "time", -] +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" dependencies = [ "portable-atomic", ] [[package]] name = "postgres" -version = "0.19.12" +version = "0.19.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c48ece1c6cda0db61b058c1721378da76855140e9214339fa1317decacb176" +checksum = "aacf632d0554ff75f58183694f41dc8999c8a3a43a386994d0ec2d034f1dfbe1" dependencies = [ "bytes", "fallible-iterator 0.2.0", @@ -1381,9 +1534,9 @@ dependencies = [ [[package]] name = "postgres-native-tls" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac73153d92e4bde922bd6f1dfba7f1ab8132266c031153b55e20a1521cd36d49" +checksum = "fef4de47bb81477e0c3deaf153a1b10ae176484713ff1640969f4cb96b653ebc" dependencies = [ "native-tls", "tokio", @@ -1393,9 +1546,9 @@ dependencies = [ [[package]] name = "postgres-protocol" -version = "0.6.9" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbef655056b916eb868048276cfd5d6a7dea4f81560dfd047f97c8c6fe3fcfd4" +checksum = "56201207dac53e2f38e848e31b4b91616a6bb6e0c7205b77718994a7f49e70fc" dependencies = [ "base64", "byteorder", @@ -1404,16 +1557,16 @@ dependencies = [ "hmac", "md-5", "memchr", - "rand", - "sha2", + "rand 0.10.1", + "sha2 0.11.0", "stringprep", ] [[package]] name = "postgres-types" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4605b7c057056dd35baeb6ac0c0338e4975b1f2bef0f65da953285eb007095" +checksum = "8dc729a129e682e8d24170cd30ae1aa01b336b096cbb56df6d534ffec133d186" dependencies = [ "bytes", "fallible-iterator 0.2.0", @@ -1422,9 +1575,9 @@ dependencies = [ [[package]] name = "potential_utf" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" dependencies = [ "zerovec", ] @@ -1446,9 +1599,9 @@ dependencies = [ [[package]] name = "predicates" -version = "3.1.3" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" +checksum = "ada8f2932f28a27ee7b70dd6c1c39ea0675c55a36879ab92f3a715eaa1e63cfe" dependencies = [ "anstyle", "difflib", @@ -1460,15 +1613,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" +checksum = "cad38746f3166b4031b1a0d39ad9f954dd291e7854fcc0eed52ee41a0b50d144" [[package]] name = "predicates-tree" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" +checksum = "d0de1b847b39c8131db0467e9df1ff60e6d0562ab8e9a16e568ad0fdb372e2f2" dependencies = [ "predicates-core", "termtree", @@ -1481,28 +1634,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6fa0831dd7cc608c38a5e323422a0077678fa5744aa2be4ad91c4ece8eec8d5" [[package]] -name = "proc-macro2" -version = "1.0.101" +name = "prettyplease" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ - "unicode-ident", + "proc-macro2", + "syn", ] [[package]] -name = "quick-xml" -version = "0.38.3" +name = "proc-macro2" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a232e7487fc2ef313d96dde7948e7a3c05101870d8985e4fd8d26aedd27b89" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ - "memchr", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.41" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -1513,6 +1667,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rand" version = "0.9.4" @@ -1520,28 +1680,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" dependencies = [ "rand_chacha", - "rand_core", + "rand_core 0.9.5", ] [[package]] -name = "rand_chacha" +name = "rand" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.5", ] [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom", + "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "redox_syscall" version = "0.5.18" @@ -1561,6 +1738,7 @@ dependencies = [ "predicates", "refinery-core", "refinery-macros", + "rustls", "tempfile", "time", "tokio", @@ -1583,14 +1761,17 @@ dependencies = [ "postgres-native-tls", "regex", "rusqlite", + "rustls", + "rustls-native-certs", "serde", "siphasher", "tempfile", - "thiserror 2.0.17", + "thiserror 2.0.18", "tiberius", "time", "tokio", "tokio-postgres", + "tokio-postgres-rustls", "tokio-util", "toml 0.8.23", "url", @@ -1642,9 +1823,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.3" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -1654,9 +1835,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -1665,9 +1846,23 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.6" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "ring" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] [[package]] name = "rsqlite-vfs" @@ -1676,7 +1871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a1f2315036ef6b1fbacd1972e8ee7688030b0a2121edfc2a6550febd41574d" dependencies = [ "hashbrown 0.16.1", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -1696,15 +1891,15 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags", "errno", @@ -1714,16 +1909,56 @@ dependencies = [ ] [[package]] -name = "rustversion" -version = "1.0.22" +name = "rustls" +version = "0.23.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "69f9466fb2c14ea04357e91413efb882e2a6d4a406e625449bc0a5d360d53a21" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "zeroize", +] [[package]] -name = "ryu" -version = "1.0.20" +name = "rustls-webpki" +version = "0.103.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "same-file" @@ -1742,9 +1977,9 @@ checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71" [[package]] name = "schannel" -version = "0.1.28" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" dependencies = [ "windows-sys 0.61.2", ] @@ -1757,9 +1992,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.11.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ "bitflags", "core-foundation", @@ -1770,14 +2005,20 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.15.0" +version = "2.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" dependencies = [ "core-foundation-sys", "libc", ] +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.228" @@ -1810,15 +2051,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] @@ -1832,9 +2073,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.0.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" dependencies = [ "serde_core", ] @@ -1846,8 +2087,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", ] [[package]] @@ -1857,8 +2098,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "digest 0.11.2", ] [[package]] @@ -1869,30 +2121,31 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.6" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc", ] [[package]] name = "simd-adler32" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" [[package]] name = "siphasher" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" @@ -1912,19 +2165,29 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", ] [[package]] name = "sqlite-wasm-rs" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4206ed3a67690b9c29b77d728f6acc3ce78f16bf846d83c94f76400320181b" +checksum = "1b2c760607300407ddeaee518acf28c795661b7108c75421303dbefb237d3a36" dependencies = [ "cc", "js-sys", @@ -1963,9 +2226,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.106" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -1983,14 +2246,28 @@ dependencies = [ "syn", ] +[[package]] +name = "sysinfo" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ab6a2f8bfe508deb3c6406578252e491d299cbbf3bc0529ecc3313aee4a52f" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows", +] + [[package]] name = "tempfile" -version = "3.23.0" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom", + "getrandom 0.4.2", "once_cell", "rustix", "windows-sys 0.61.2", @@ -2013,11 +2290,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.18", ] [[package]] @@ -2033,9 +2310,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -2098,9 +2375,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" dependencies = [ "displaydoc", "zerovec", @@ -2108,9 +2385,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" dependencies = [ "tinyvec_macros", ] @@ -2121,31 +2398,49 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tls_codec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de2e01245e2bb89d6f05801c564fa27624dbd7b1846859876c7dad82e90bf6b" +dependencies = [ + "tls_codec_derive", + "zeroize", +] + +[[package]] +name = "tls_codec_derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2e76690929402faae40aebdda620a2c0e25dd6d3b9afe48867dfd95991f4bd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tokio" -version = "1.47.1" +version = "1.52.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6" dependencies = [ - "backtrace", "bytes", - "io-uring", "libc", "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", - "slab", - "socket2 0.6.0", + "socket2 0.6.3", "tokio-macros", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" dependencies = [ "proc-macro2", "quote", @@ -2164,9 +2459,9 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.15" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b40d66d9b2cfe04b628173409368e58247e8eddbbd3b0e6c6ba1d09f20f6c9e" +checksum = "4dd8df5ef180f6364759a6f00f7aadda4fbbac86cdee37480826a6ff9f3574ce" dependencies = [ "async-trait", "byteorder", @@ -2181,18 +2476,43 @@ dependencies = [ "pin-project-lite", "postgres-protocol", "postgres-types", - "rand", - "socket2 0.6.0", + "rand 0.10.1", + "socket2 0.6.3", "tokio", "tokio-util", "whoami", ] +[[package]] +name = "tokio-postgres-rustls" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d684bad428a0f2481f42241f821db42c54e2dc81d8c00db8536c506b0a0144" +dependencies = [ + "const-oid 0.9.6", + "ring", + "rustls", + "tokio", + "tokio-postgres", + "tokio-rustls", + "x509-cert", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-util" -version = "0.7.16" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", @@ -2216,13 +2536,13 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.7" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" dependencies = [ "serde_core", - "serde_spanned 1.0.2", - "toml_datetime 0.7.2", + "serde_spanned 1.1.1", + "toml_datetime 1.1.1+spec-1.1.0", "toml_writer", ] @@ -2237,9 +2557,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.2" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ "serde_core", ] @@ -2266,15 +2586,15 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" [[package]] name = "toml_writer" -version = "1.0.3" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "log", "pin-project-lite", @@ -2284,9 +2604,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -2295,9 +2615,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", ] @@ -2310,9 +2630,9 @@ checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c" [[package]] name = "typenum" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" [[package]] name = "unicode-bidi" @@ -2322,30 +2642,42 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-normalization" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" dependencies = [ "tinyvec", ] [[package]] name = "unicode-properties" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.7" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", @@ -2367,11 +2699,11 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.18.1" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76" dependencies = [ - "getrandom", + "getrandom 0.4.2", "js-sys", "wasm-bindgen", ] @@ -2424,24 +2756,36 @@ dependencies = [ [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.51.0", ] [[package]] name = "wasite" -version = "0.1.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" +checksum = "66fe902b4a6b8028a753d5424909b764ccf79b7a209eac9bf97e59cda9f71a42" +dependencies = [ + "wasi 0.14.7+wasi-0.2.4", +] [[package]] name = "wasm-bindgen" -version = "0.2.104" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" dependencies = [ "cfg-if", "once_cell", @@ -2450,25 +2794,11 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - [[package]] name = "wasm-bindgen-macro" -version = "0.2.104" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2476,31 +2806,65 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.104" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" dependencies = [ + "bumpalo", "proc-macro2", "quote", "syn", - "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.104" +version = "0.2.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + [[package]] name = "web-sys" -version = "0.3.81" +version = "0.3.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d" dependencies = [ "js-sys", "wasm-bindgen", @@ -2508,11 +2872,13 @@ dependencies = [ [[package]] name = "whoami" -version = "1.6.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" +checksum = "d6a5b12f9df4f978d2cfdb1bd3bac52433f44393342d7ee9c25f5a1c14c0f45d" dependencies = [ + "libc", "libredox", + "objc2-system-configuration", "wasite", "web-sys", ] @@ -2548,6 +2914,73 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "windows-link" version = "0.2.1" @@ -2555,30 +2988,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "windows-sys" -version = "0.52.0" +name = "windows-numerics" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-targets 0.52.6", + "windows-core", + "windows-link", ] [[package]] -name = "windows-sys" -version = "0.59.0" +name = "windows-result" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-targets 0.52.6", + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", ] [[package]] name = "windows-sys" -version = "0.60.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.53.5", + "windows-targets", ] [[package]] @@ -2596,31 +3039,23 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] -name = "windows-targets" -version = "0.53.5" +name = "windows-threading" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ "windows-link", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", ] [[package]] @@ -2629,36 +3064,18 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - [[package]] name = "windows_i686_gnullvm" version = "0.52.6" @@ -2666,87 +3083,156 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" +name = "windows_i686_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] -name = "windows_i686_msvc" +name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] -name = "windows_i686_msvc" -version = "0.53.1" +name = "windows_x86_64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] -name = "windows_x86_64_gnu" +name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" +name = "winnow" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] [[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" +name = "wit-bindgen" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] [[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" +name = "wit-bindgen" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" [[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" +name = "wit-bindgen-core" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] [[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" +name = "wit-bindgen-rust" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] [[package]] -name = "winnow" -version = "0.7.13" +name = "wit-bindgen-rust-macro" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" dependencies = [ - "memchr", + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", ] [[package]] -name = "wit-bindgen" -version = "0.46.0" +name = "wit-component" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] [[package]] name = "writeable" -version = "0.6.1" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "x509-cert" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" +checksum = "1301e935010a701ae5f8655edc0ad17c44bad3ac5ce8c39185f75453b720ae94" +dependencies = [ + "const-oid 0.9.6", + "der", + "spki", + "tls_codec", +] [[package]] name = "yoke" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" dependencies = [ - "serde", "stable_deref_trait", "yoke-derive", "zerofrom", @@ -2754,9 +3240,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" dependencies = [ "proc-macro2", "quote", @@ -2766,18 +3252,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.27" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.27" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" dependencies = [ "proc-macro2", "quote", @@ -2786,18 +3272,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" dependencies = [ "proc-macro2", "quote", @@ -2805,11 +3291,31 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zerotrie" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" dependencies = [ "displaydoc", "yoke", @@ -2818,9 +3324,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" dependencies = [ "yoke", "zerofrom", @@ -2829,11 +3335,17 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.1" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" dependencies = [ "proc-macro2", "quote", "syn", ] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/deny.toml b/deny.toml index ed337b01..fdcce230 100644 --- a/deny.toml +++ b/deny.toml @@ -37,6 +37,7 @@ allow = [ "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", + "ISC", "MIT", "Unlicense", "Unicode-3.0", diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 1218459b..3b731d0a 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -19,8 +19,9 @@ rusqlite = ["refinery-core/rusqlite", "config"] postgres-tls = ["refinery-core/postgres-tls", "config"] postgres = ["refinery-core/postgres"] mysql = ["refinery-core/mysql", "config"] -tokio-postgres-tls = ["refinery-core/tokio-postgres-tls", "config"] +tokio-postgres-tls = ["tokio-postgres", "refinery-core/tokio-postgres-tls"] tokio-postgres = ["refinery-core/tokio-postgres"] +tokio-postgres-rustls = ["tokio-postgres", "refinery-core/tokio-postgres-rustls"] mysql_async = ["refinery-core/mysql_async", "config"] tiberius = ["refinery-core/tiberius", "config"] tiberius-config = ["refinery-core/tiberius", "refinery-core/tiberius-config", "config"] @@ -42,3 +43,4 @@ tempfile = "3" time = "0.3.5" tokio-util = { version = "0.7.7", features = ["compat"] } tokio = { version = "1.9.0", features = ["full"] } +rustls = { version = "0.23", default-features = false, features = ["ring"] } diff --git a/refinery/tests/tokio_postgres.rs b/refinery/tests/tokio_postgres.rs index 304c85e7..71f9827c 100644 --- a/refinery/tests/tokio_postgres.rs +++ b/refinery/tests/tokio_postgres.rs @@ -3,12 +3,8 @@ use barrel::backend::Pg as Sql; #[cfg(feature = "tokio-postgres")] mod tokio_postgres { use futures::FutureExt; - use refinery::{ - config::{Config, ConfigDbType}, - embed_migrations, - error::Kind, - AsyncMigrate, Migration, Runner, Target, - }; + use refinery::{embed_migrations, error::Kind, AsyncMigrate, Migration, Runner, Target}; + use refinery_core::config::Config; use refinery_core::tokio_postgres; use refinery_core::tokio_postgres::NoTls; use std::panic::AssertUnwindSafe; @@ -17,6 +13,23 @@ mod tokio_postgres { const DEFAULT_TABLE_NAME: &str = "refinery_schema_history"; + fn db_url(db: &str) -> String { + let base = std::env::var("POSTGRES_URL") + .unwrap_or_else(|_| "postgres://postgres@localhost:5432".to_string()); + // Skip past "://" then find the first '/' which separates authority from path + let after_scheme = base.find("://").map(|i| i + 3).unwrap_or(0); + let base = if let Some(pos) = base[after_scheme..].find('/') { + base[..after_scheme + pos].to_string() + } else { + base + }; + format!("{base}/{db}") + } + + fn db_config(db: &str) -> Config { + Config::from_str(&db_url(db)).unwrap() + } + fn get_migrations() -> Vec { embed_migrations!("./tests/migrations"); @@ -72,10 +85,9 @@ mod tokio_postgres { } async fn clean_database() { - let (client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/template1", NoTls) - .await - .unwrap(); + let (client, connection) = tokio_postgres::connect(db_url("template1").as_str(), NoTls) + .await + .unwrap(); tokio::spawn(async move { connection.await.unwrap(); @@ -100,7 +112,7 @@ mod tokio_postgres { async fn report_contains_applied_migrations() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -140,7 +152,7 @@ mod tokio_postgres { async fn creates_migration_table() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -175,7 +187,7 @@ mod tokio_postgres { async fn creates_migration_table_grouped_migrations() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -211,7 +223,7 @@ mod tokio_postgres { async fn applies_migration() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -250,7 +262,7 @@ mod tokio_postgres { async fn applies_migration_grouped() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -290,7 +302,7 @@ mod tokio_postgres { async fn updates_schema_history() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -322,7 +334,7 @@ mod tokio_postgres { async fn updates_schema_history_grouped() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -355,7 +367,7 @@ mod tokio_postgres { async fn updates_to_last_working_if_not_grouped() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -399,7 +411,7 @@ mod tokio_postgres { async fn doesnt_update_to_last_working_if_grouped() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -428,7 +440,7 @@ mod tokio_postgres { async fn gets_applied_migrations() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -470,7 +482,7 @@ mod tokio_postgres { async fn applies_new_migration() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -513,7 +525,7 @@ mod tokio_postgres { async fn migrates_to_target_migration() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -558,7 +570,7 @@ mod tokio_postgres { async fn migrates_to_target_migration_grouped() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -604,7 +616,7 @@ mod tokio_postgres { async fn aborts_on_missing_migration_on_filesystem() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -649,7 +661,7 @@ mod tokio_postgres { async fn aborts_on_divergent_migration() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -696,7 +708,7 @@ mod tokio_postgres { async fn aborts_on_missing_migration_on_database() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -752,11 +764,7 @@ mod tokio_postgres { #[tokio::test] async fn migrates_from_config() { run_test(async { - let mut config = Config::new(ConfigDbType::Postgres) - .set_db_name("postgres") - .set_db_user("postgres") - .set_db_host("localhost") - .set_db_port("5432"); + let mut config = db_config("postgres"); let migrations = get_migrations(); let runner = Runner::new(&migrations) @@ -796,11 +804,7 @@ mod tokio_postgres { #[tokio::test] async fn migrate_from_config_report_contains_migrations() { run_test(async { - let mut config = Config::new(ConfigDbType::Postgres) - .set_db_name("postgres") - .set_db_user("postgres") - .set_db_host("localhost") - .set_db_port("5432"); + let mut config = db_config("postgres"); let migrations = get_migrations(); let runner = Runner::new(&migrations) @@ -837,11 +841,7 @@ mod tokio_postgres { #[tokio::test] async fn migrate_from_config_report_returns_last_applied_migration() { run_test(async { - let mut config = Config::new(ConfigDbType::Postgres) - .set_db_name("postgres") - .set_db_user("postgres") - .set_db_host("localhost") - .set_db_port("5432"); + let mut config = db_config("postgres"); let migrations = get_migrations(); let runner = Runner::new(&migrations) @@ -869,7 +869,7 @@ mod tokio_postgres { async fn doesnt_run_migrations_if_fake() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -913,7 +913,7 @@ mod tokio_postgres { async fn doesnt_run_migrations_if_fake_version() { run_test(async { let (mut client, connection) = - tokio_postgres::connect("postgres://postgres@localhost:5432/postgres", NoTls) + tokio_postgres::connect(db_url("postgres").as_str(), NoTls) .await .unwrap(); @@ -953,12 +953,45 @@ mod tokio_postgres { .await; } + #[cfg(feature = "tokio-postgres-tls")] #[tokio::test] async fn migrates_with_tls_enabled() { run_test(async { let mut config = - Config::from_str("postgres://postgres@localhost:5432/postgres?sslmode=require") - .unwrap(); + Config::from_str(&format!("{}?sslmode=require", db_url("postgres"))).unwrap(); + + let migrations = get_migrations(); + let runner = Runner::new(&migrations) + .set_grouped(false) + .set_abort_divergent(true) + .set_abort_missing(true); + + let report = runner.run_async(&mut config).await.unwrap(); + + let applied_migrations = report.applied_migrations(); + assert_eq!(5, applied_migrations.len()); + + let last_migration = runner + .get_last_applied_migration_async(&mut config) + .await + .unwrap() + .unwrap(); + + assert_eq!(5, last_migration.version()); + assert_eq!(migrations[4].name(), last_migration.name()); + assert_eq!(migrations[4].checksum(), last_migration.checksum()); + + assert!(config.use_tls()); + }) + .await; + } + + #[cfg(feature = "tokio-postgres-rustls")] + #[tokio::test] + async fn migrates_with_rustls_enabled() { + run_test(async { + let mut config = + Config::from_str(&format!("{}?sslmode=require", db_url("postgres"))).unwrap(); let migrations = get_migrations(); let runner = Runner::new(&migrations) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 4ef3c851..131161ec 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -24,6 +24,7 @@ tokio-postgres = ["dep:tokio-postgres", "dep:tokio", "tokio/rt"] tokio-postgres-tls = ["tokio-postgres", "postgres-tls", "config"] toml = ["serde", "dep:toml"] int8-versions = [] +tokio-postgres-rustls = ["dep:tokio-postgres-rustls", "dep:rustls", "dep:rustls-native-certs", "tokio-postgres", "config"] [dependencies] async-trait = "0.1" @@ -50,6 +51,9 @@ tokio-util = { version = "0.7.7", features = ["compat"], optional = true } time = { version = "0.3.5", features = ["parsing", "formatting"] } serde = { version = "1", features = ["derive"], optional = true } toml = { version = "0.8.8", optional = true } +rustls = { version = "0.23", default-features = false, optional = true } +rustls-native-certs = { version = "0.8", optional = true } +tokio-postgres-rustls = { version = "0.13", optional = true } [dev-dependencies] barrel = { git = "https://github.com/jxs/barrel", features = ["sqlite3", "pg", "mysql", "mssql"] } diff --git a/refinery_core/src/drivers/config.rs b/refinery_core/src/drivers/config.rs index 3f1cfd74..d7d7192d 100644 --- a/refinery_core/src/drivers/config.rs +++ b/refinery_core/src/drivers/config.rs @@ -95,12 +95,26 @@ macro_rules! with_connection { let path = crate::config::build_db_url("postgresql", &$config); let conn; - if $config.use_tls() { - let connector = native_tls::TlsConnector::new().unwrap(); - let connector = postgres_native_tls::MakeTlsConnector::new(connector); - conn = postgres::Client::connect(path.as_str(), connector).migration_err("could not connect to database", None)?; - } else { - conn = postgres::Client::connect(path.as_str(), postgres::NoTls).migration_err("could not connect to database", None)?; + cfg_if::cfg_if! { + if #[cfg(feature = "tls")] { + if $config.use_tls() { + let connector = native_tls::TlsConnector::new().unwrap(); + let connector = postgres_native_tls::MakeTlsConnector::new(connector); + conn = postgres::Client::connect(path.as_str(), connector).migration_err("could not connect to database", None)?; + } else { + conn = postgres::Client::connect(path.as_str(), postgres::NoTls).migration_err("could not connect to database", None)?; + } + } else if #[cfg(feature = "tokio-postgres-rustls")] { + if $config.use_tls() { + panic!("tokio-postgres-rustls only supports the async tokio-postgres driver; enable the 'tls' feature to use TLS with the sync postgres driver"); + } + conn = postgres::Client::connect(path.as_str(), postgres::NoTls).migration_err("could not connect to database", None)?; + } else { + if $config.use_tls() { + panic!("TLS was requested but neither 'tls' nor 'tokio-postgres-rustls' feature is enabled in refinery-core"); + } + conn = postgres::Client::connect(path.as_str(), postgres::NoTls).migration_err("could not connect to database", None)?; + } } $op(conn) @@ -143,24 +157,67 @@ macro_rules! with_connection_async { cfg_if::cfg_if! { if #[cfg(feature = "tokio-postgres")] { let path = crate::config::build_db_url("postgresql", $config); - if $config.use_tls() { - let connector = native_tls::TlsConnector::new().unwrap(); - let connector = postgres_native_tls::MakeTlsConnector::new(connector); - let (client, connection) = tokio_postgres::connect(path.as_str(), connector).await.migration_err("could not connect to database", None)?; - tokio::spawn(async move { - if let Err(e) = connection.await { - eprintln!("connection error: {}", e); + cfg_if::cfg_if! { + if #[cfg(feature = "tls")] { + if $config.use_tls() { + let connector = native_tls::TlsConnector::new().unwrap(); + let connector = postgres_native_tls::MakeTlsConnector::new(connector); + let (client, connection) = tokio_postgres::connect(path.as_str(), connector).await.migration_err("could not connect to database", None)?; + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + $op(client).await + } else { + let (client, connection) = tokio_postgres::connect(path.as_str(), tokio_postgres::NoTls).await.migration_err("could not connect to database", None)?; + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + $op(client).await + } + } else if #[cfg(feature = "tokio-postgres-rustls")] { + if $config.use_tls() { + let native_certs = rustls_native_certs::load_native_certs(); + for err in &native_certs.errors { + log::warn!("Failed to load native TLS certificate: {err}"); + } + let mut root_store = rustls::RootCertStore::empty(); + root_store.add_parsable_certificates(native_certs.certs); + let tls_config = rustls::ClientConfig::builder() + .with_root_certificates(root_store) + .with_no_client_auth(); + let tls = tokio_postgres_rustls::MakeRustlsConnect::new(tls_config); + let (client, connection) = tokio_postgres::connect(path.as_str(), tls).await.migration_err("could not connect to database", None)?; + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + $op(client).await + } else { + let (client, connection) = tokio_postgres::connect(path.as_str(), tokio_postgres::NoTls).await.migration_err("could not connect to database", None)?; + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + $op(client).await } - }); - $op(client).await - } else { - let (client, connection) = tokio_postgres::connect(path.as_str(), tokio_postgres::NoTls).await.migration_err("could not connect to database", None)?; - tokio::spawn(async move { - if let Err(e) = connection.await { - eprintln!("connection error: {}", e); + } else { + if $config.use_tls() { + panic!("TLS was requested but neither 'tls' nor 'tokio-postgres-rustls' feature is enabled in refinery-core"); } - }); - $op(client).await + let (client, connection) = tokio_postgres::connect(path.as_str(), tokio_postgres::NoTls).await.migration_err("could not connect to database", None)?; + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + $op(client).await + } } } else { panic!("tried to migrate async from config for a postgresql database, but tokio-postgres was not enabled!"); From 14354f54c51a07c9615a78d6432861e0ef7a2db3 Mon Sep 17 00:00:00 2001 From: Maria Chrysafis Date: Thu, 14 May 2026 08:59:23 -0700 Subject: [PATCH 60/64] fix (#430) --- refinery_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 131161ec..1072bcb8 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -50,7 +50,7 @@ futures = { version = "0.3.16", optional = true, features = ["async-await"] } tokio-util = { version = "0.7.7", features = ["compat"], optional = true } time = { version = "0.3.5", features = ["parsing", "formatting"] } serde = { version = "1", features = ["derive"], optional = true } -toml = { version = "0.8.8", optional = true } +toml = { version = "1.1.2", optional = true } rustls = { version = "0.23", default-features = false, optional = true } rustls-native-certs = { version = "0.8", optional = true } tokio-postgres-rustls = { version = "0.13", optional = true } From 458951a4adcfea7e9488c3329af205b002fe7a02 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 May 2026 10:17:17 +0100 Subject: [PATCH 61/64] Bump openssl from 0.10.78 to 0.10.80 (#432) Bumps [openssl](https://github.com/rust-openssl/rust-openssl) from 0.10.78 to 0.10.80. - [Release notes](https://github.com/rust-openssl/rust-openssl/releases) - [Commits](https://github.com/rust-openssl/rust-openssl/compare/openssl-v0.10.78...openssl-v0.10.80) --- updated-dependencies: - dependency-name: openssl dependency-version: 0.10.80 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e30e6168..0d9efd31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1391,15 +1391,14 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "openssl" -version = "0.10.78" +version = "0.10.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38c4372413cdaaf3cc79dd92d29d7d9f5ab09b51b10dded508fb90bb70b9222" +checksum = "a45fa2aa886c42762255da344f0a0d313e254066c46aad76f300c3d3da62d967" dependencies = [ "bitflags", "cfg-if", "foreign-types", "libc", - "once_cell", "openssl-macros", "openssl-sys", ] @@ -1423,9 +1422,9 @@ checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] name = "openssl-sys" -version = "0.9.114" +version = "0.9.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13ce1245cd07fcc4cfdb438f7507b0c7e4f3849a69fd84d52374c66d83741bb6" +checksum = "f28a22dc7140cda5f096e5e7724a6962ca81a7f8bfd2979f9b18c11af56318c4" dependencies = [ "cc", "libc", @@ -1773,7 +1772,7 @@ dependencies = [ "tokio-postgres", "tokio-postgres-rustls", "tokio-util", - "toml 0.8.23", + "toml 1.1.2+spec-1.1.0", "url", "walkdir", ] @@ -2540,10 +2539,13 @@ version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" dependencies = [ + "indexmap", "serde_core", "serde_spanned 1.1.1", "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", "toml_writer", + "winnow 1.0.3", ] [[package]] @@ -2575,7 +2577,16 @@ dependencies = [ "serde_spanned 0.6.9", "toml_datetime 0.6.11", "toml_write", - "winnow", + "winnow 0.7.15", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.3", ] [[package]] @@ -3115,6 +3126,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" + [[package]] name = "wit-bindgen" version = "0.51.0" From d6ba618d44d8b4866536291520507229a3fce135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 9 Jun 2026 15:01:58 +0100 Subject: [PATCH 62/64] backport 0.9.1 (#423) (#434) * Prepare 0.9.1 (#423) * prepare 0.9.1 * Support rusqlite 0.38.x (#410) Co-authored-by: Youser Nayme <7685106-NeuralModder@users.noreply.gitlab.com> * do not log warning on nested dirs when finding migrations (#421) --------- Co-authored-by: Youser Nayme <51252915+NeuralModder@users.noreply.github.com> Co-authored-by: Youser Nayme <7685106-NeuralModder@users.noreply.gitlab.com> * Apply suggestion from @jxs * Update refinery/Cargo.toml --------- Co-authored-by: Youser Nayme <51252915+NeuralModder@users.noreply.github.com> Co-authored-by: Youser Nayme <7685106-NeuralModder@users.noreply.gitlab.com> --- CHANGELOG.md | 6 ++++++ refinery/Cargo.toml | 6 +++--- refinery_cli/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 4 ++-- refinery_macros/Cargo.toml | 4 ++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f88530e2..c0870fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.1] - 2026-04-15 +### Changed +- Support `rusqlite` 0.38.x. [#410](https://github.com/rust-db/refinery/pull/410) +### Fixed +- Avoid warning logs for nested directories while scanning migrations. [#421](https://github.com/rust-db/refinery/pull/421) + ## [0.9.0] - 2025-01-06 ### Added - Support for TLS in postgres/tokio-postgres using native-tls. [#353](https://github.com/rust-db/refinery/pull/353) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 3b731d0a..4a8e5fa1 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery" -version = "0.9.0" +version = "0.9.1" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" description = "Powerful SQL migration toolkit for Rust" @@ -31,8 +31,8 @@ enums = ["refinery-macros/enums"] int8-versions = ["refinery-core/int8-versions", "refinery-macros/int8-versions"] [dependencies] -refinery-core = { version = "0.9.0", path = "../refinery_core", default-features = false } -refinery-macros = { version = "0.9.0", path = "../refinery_macros" } +refinery-core = { version = "0.9.1", path = "../refinery_core", default-features = false } +refinery-macros = { version = "0.9.1", path = "../refinery_macros" } [dev-dependencies] barrel = { git = "https://github.com/jxs/barrel", features = ["sqlite3", "pg", "mysql", "mssql"] } diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index 127bcc97..450a9bd8 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery_cli" -version = "0.9.0" +version = "0.9.1" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT OR Apache-2.0" description = "Provides the CLI for the Refinery crate" @@ -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", "config"] } +refinery-core = { version = "0.9.1", path = "../refinery_core", default-features = false, features = ["toml", "config"] } clap = { version = "4", features = ["derive"] } human-panic = "2" toml = "0.8" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 1072bcb8..45e95430 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-core" -version = "0.9.0" +version = "0.9.1" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" @@ -40,7 +40,7 @@ walkdir = "2.3.1" rusqlite = { version = ">= 0.23, <= 0.39", optional = true } postgres = { version = ">=0.17, <= 0.19", optional = true } native-tls = { version = "0.2", optional = true } -postgres-native-tls = { version = "0.5", optional = true} +postgres-native-tls = { version = "0.5", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } mysql = { version = ">= 21.0.0, <= 26", optional = true, default-features = false, features = ["minimal"] } mysql_async = { version = ">= 0.28, <= 0.36", optional = true, default-features = false, features = ["minimal"] } diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index f36c8fac..36701ce3 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-macros" -version = "0.9.0" +version = "0.9.1" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" @@ -16,7 +16,7 @@ int8-versions = ["refinery-core/int8-versions"] proc-macro = true [dependencies] -refinery-core = { version = "0.9.0", path = "../refinery_core" } +refinery-core = { version = "0.9.1", path = "../refinery_core" } quote = "1" syn = "2" proc-macro2 = "1" From 46721b3fb1a3c3e3c81d54e8356af00cf4a99ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Tue, 9 Jun 2026 15:37:17 +0100 Subject: [PATCH 63/64] Bump mysql to 0.28.x and mysql_async to 0.37.x (#436) --- refinery_core/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 45e95430..27a95932 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -42,8 +42,8 @@ postgres = { version = ">=0.17, <= 0.19", optional = true } native-tls = { version = "0.2", optional = true } postgres-native-tls = { version = "0.5", optional = true } tokio-postgres = { version = ">= 0.5, <= 0.7", optional = true } -mysql = { version = ">= 21.0.0, <= 26", optional = true, default-features = false, features = ["minimal"] } -mysql_async = { version = ">= 0.28, <= 0.36", optional = true, default-features = false, features = ["minimal"] } +mysql = { version = ">= 21.0.0, <= 28", optional = true, default-features = false, features = ["minimal"] } +mysql_async = { version = ">= 0.28, <= 0.37", optional = true, default-features = false, features = ["minimal"] } tiberius = { version = ">= 0.7, <= 0.12", optional = true, default-features = false } tokio = { version = "1.0", optional = true } futures = { version = "0.3.16", optional = true, features = ["async-await"] } From bc1a829d6d50bef16ce9279a6ebfab4910a17d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Wed, 10 Jun 2026 19:23:26 +0100 Subject: [PATCH 64/64] Prepare 0.9.2 (#437) * Prepare 0.9.2 - Bump versions to 0.9.2 in all crates - Update inter-crate dependency references - Add 0.9.2 changelog entries for TLS opt-in (#408), tokio-postgres-rustls feature (#426), rusqlite 0.39.x (#425), and toml 1.1.2 (#430) * Bump mysql to 0.28.x and mysql_async to 0.37.x * Apply suggestion from @jxs * Apply suggestion from @jxs --- CHANGELOG.md | 9 +++++++++ refinery/Cargo.toml | 6 +++--- refinery_cli/Cargo.toml | 4 ++-- refinery_core/Cargo.toml | 2 +- refinery_macros/Cargo.toml | 4 ++-- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0870fae..8b52454c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.2] - 2026-06-09 +### Added +- Support for `rustls` as a TLS backend for `tokio-postgres` via the new `tokio-postgres-rustls` feature. [#426](https://github.com/rust-db/refinery/pull/426) +### Changed +- Make TLS opt-in for `postgres` and `tokio-postgres` features. The `postgres` and `tokio-postgres` features no longer pull in `native-tls` unconditionally. Use `postgres-tls` and `tokio-postgres-tls` features for TLS support. [#408](https://github.com/rust-db/refinery/pull/408) +- Support `rusqlite` 0.39.x. [#425](https://github.com/rust-db/refinery/pull/425) +- Support `mysql` up to 0.28.x and `mysql_async` up to 0.37.x. [#436](https://github.com/rust-db/refinery/pull/436) +- Update `toml` dependency to 1.1.2. [#430](https://github.com/rust-db/refinery/pull/430) + ## [0.9.1] - 2026-04-15 ### Changed - Support `rusqlite` 0.38.x. [#410](https://github.com/rust-db/refinery/pull/410) diff --git a/refinery/Cargo.toml b/refinery/Cargo.toml index 4a8e5fa1..7471624c 100644 --- a/refinery/Cargo.toml +++ b/refinery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery" -version = "0.9.1" +version = "0.9.2" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT" description = "Powerful SQL migration toolkit for Rust" @@ -31,8 +31,8 @@ enums = ["refinery-macros/enums"] int8-versions = ["refinery-core/int8-versions", "refinery-macros/int8-versions"] [dependencies] -refinery-core = { version = "0.9.1", path = "../refinery_core", default-features = false } -refinery-macros = { version = "0.9.1", path = "../refinery_macros" } +refinery-core = { version = "0.9.2", path = "../refinery_core", default-features = false } +refinery-macros = { version = "0.9.2", path = "../refinery_macros" } [dev-dependencies] barrel = { git = "https://github.com/jxs/barrel", features = ["sqlite3", "pg", "mysql", "mssql"] } diff --git a/refinery_cli/Cargo.toml b/refinery_cli/Cargo.toml index 450a9bd8..a153cc8d 100644 --- a/refinery_cli/Cargo.toml +++ b/refinery_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery_cli" -version = "0.9.1" +version = "0.9.2" authors = ["Katharina Fey ", "João Oliveira "] license = "MIT OR Apache-2.0" description = "Provides the CLI for the Refinery crate" @@ -24,7 +24,7 @@ mssql = ["refinery-core/tiberius-config", "tokio"] int8-versions = ["refinery-core/int8-versions"] [dependencies] -refinery-core = { version = "0.9.1", path = "../refinery_core", default-features = false, features = ["toml", "config"] } +refinery-core = { version = "0.9.2", path = "../refinery_core", default-features = false, features = ["toml", "config"] } clap = { version = "4", features = ["derive"] } human-panic = "2" toml = "0.8" diff --git a/refinery_core/Cargo.toml b/refinery_core/Cargo.toml index 27a95932..51edba25 100644 --- a/refinery_core/Cargo.toml +++ b/refinery_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-core" -version = "0.9.1" +version = "0.9.2" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" diff --git a/refinery_macros/Cargo.toml b/refinery_macros/Cargo.toml index 36701ce3..1aadb11a 100644 --- a/refinery_macros/Cargo.toml +++ b/refinery_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "refinery-macros" -version = "0.9.1" +version = "0.9.2" authors = ["Katharina Fey ", "João Oliveira "] description = "This crate should not be used directly, it is internally related to Refinery" license = "MIT OR Apache-2.0" @@ -16,7 +16,7 @@ int8-versions = ["refinery-core/int8-versions"] proc-macro = true [dependencies] -refinery-core = { version = "0.9.1", path = "../refinery_core" } +refinery-core = { version = "0.9.2", path = "../refinery_core" } quote = "1" syn = "2" proc-macro2 = "1"