From ff22645d3acc9c1b399894829134e9a8ae13a439 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Sat, 27 Mar 2021 02:27:20 -0700 Subject: [PATCH] Remove upstream unmaintained 'mysql' support. Also updates 'sqlite' dependencies. --- contrib/lib/Cargo.toml | 11 ++++------- contrib/lib/src/databases/mod.rs | 10 ++-------- contrib/lib/src/databases/poolable.rs | 14 -------------- scripts/test.sh | 1 - site/guide/6-state.md | 5 +---- 5 files changed, 7 insertions(+), 34 deletions(-) diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml index cbea1ba6..89fa6887 100644 --- a/contrib/lib/Cargo.toml +++ b/contrib/lib/Cargo.toml @@ -35,11 +35,10 @@ uuid = ["serde", "_uuid"] # The barage of user-facing database features. diesel_sqlite_pool = ["databases", "diesel/sqlite", "diesel/r2d2"] diesel_postgres_pool = ["databases", "diesel/postgres", "diesel/r2d2"] -diesel_mysql_pool = ["databases", "diesel/mysql", "diesel/r2d2"] postgres_pool = ["databases", "postgres", "r2d2_postgres"] -mysql_pool = ["databases", "mysql", "r2d2_mysql"] sqlite_pool = ["databases", "rusqlite", "r2d2_sqlite"] memcache_pool = ["databases", "memcache", "r2d2-memcache"] +diesel_mysql_pool = ["databases", "diesel/mysql", "diesel/r2d2"] [dependencies] # Global dependencies. @@ -51,7 +50,7 @@ log = "0.4" # Serialization and templating dependencies. serde = { version = "1.0", optional = true, features = ["derive"] } serde_json = { version = "1.0.26", optional = true } -rmp-serde = { version = "0.14.0", optional = true } +rmp-serde = { version = "0.15.0", optional = true } # Templating dependencies. handlebars = { version = "3.0", optional = true } @@ -65,10 +64,8 @@ diesel = { version = "1.0", default-features = false, optional = true } postgres = { version = "0.19", optional = true } r2d2 = { version = "0.8", optional = true } r2d2_postgres = { version = "0.18", optional = true } -mysql = { version = "18.0", optional = true } -r2d2_mysql = { version = "18.0", optional = true } -rusqlite = { version = "0.23", optional = true } -r2d2_sqlite = { version = "0.16", optional = true } +rusqlite = { version = "0.24", optional = true } +r2d2_sqlite = { version = "0.17", optional = true } memcache = { version = "0.15", optional = true } r2d2-memcache = { version = "0.6", optional = true } diff --git a/contrib/lib/src/databases/mod.rs b/contrib/lib/src/databases/mod.rs index 294066af..4937df07 100644 --- a/contrib/lib/src/databases/mod.rs +++ b/contrib/lib/src/databases/mod.rs @@ -117,7 +117,7 @@ //! //! # Option 2: //! [global.databases.my_db] -//! url = "mysql://root:root@localhost/my_db" +//! url = "postgres://root:root@localhost/my_db" //! //! # With a `pool_size` key: //! [global.databases] @@ -320,11 +320,10 @@ //! | Kind | Driver | Version | `Poolable` Type | Feature | //! |----------|-----------------------|-----------|--------------------------------|------------------------| //! | MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` | -//! | MySQL | [`rust-mysql-simple`] | `18` | [`mysql::Conn`] | `mysql_pool` | //! | Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` | //! | Postgres | [Rust-Postgres] | `0.19` | [`postgres::Client`] | `postgres_pool` | //! | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | -//! | Sqlite | [`Rusqlite`] | `0.23` | [`rusqlite::Connection`] | `sqlite_pool` | +//! | Sqlite | [`Rusqlite`] | `0.24` | [`rusqlite::Connection`] | `sqlite_pool` | //! | Memcache | [`memcache`] | `0.15` | [`memcache::Client`] | `memcache_pool` | //! //! [Diesel]: https://diesel.rs @@ -332,11 +331,9 @@ //! [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html //! [`postgres::Client`]: https://docs.rs/postgres/0.19/postgres/struct.Client.html //! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html -//! [`mysql::Conn`]: https://docs.rs/mysql/18/mysql/struct.Conn.html //! [`diesel::MysqlConnection`]: http://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html //! [`Rusqlite`]: https://github.com/jgallagher/rusqlite //! [Rust-Postgres]: https://github.com/sfackler/rust-postgres -//! [`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple //! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html //! [`memcache`]: https://github.com/aisk/rust-memcache //! [`memcache::Client`]: https://docs.rs/memcache/0.15/memcache/struct.Client.html @@ -370,9 +367,6 @@ pub extern crate diesel; #[cfg(feature = "postgres_pool")] pub extern crate postgres; #[cfg(feature = "postgres_pool")] pub extern crate r2d2_postgres; -#[cfg(feature = "mysql_pool")] pub extern crate mysql; -#[cfg(feature = "mysql_pool")] pub extern crate r2d2_mysql; - #[cfg(feature = "sqlite_pool")] pub extern crate rusqlite; #[cfg(feature = "sqlite_pool")] pub extern crate r2d2_sqlite; diff --git a/contrib/lib/src/databases/poolable.rs b/contrib/lib/src/databases/poolable.rs index 6def733e..5b78002a 100644 --- a/contrib/lib/src/databases/poolable.rs +++ b/contrib/lib/src/databases/poolable.rs @@ -12,7 +12,6 @@ use crate::databases::{Config, Error}; /// * `diesel::PgConnection` /// * `diesel::SqliteConnection` /// * `postgres::Connection` -/// * `mysql::Conn` /// * `rusqlite::Connection` /// /// # Implementation Guide @@ -155,19 +154,6 @@ impl Poolable for postgres::Client { } } -#[cfg(feature = "mysql_pool")] -impl Poolable for mysql::Conn { - type Manager = r2d2_mysql::MysqlConnectionManager; - type Error = std::convert::Infallible; - - fn pool(db_name: &str, rocket: &rocket::Rocket) -> PoolResult { - let config = Config::from(db_name, rocket)?; - let opts = mysql::OptsBuilder::from_opts(&config.url); - let manager = r2d2_mysql::MysqlConnectionManager::new(opts); - Ok(r2d2::Pool::builder().max_size(config.pool_size).build(manager)?) - } -} - #[cfg(feature = "sqlite_pool")] impl Poolable for rusqlite::Connection { type Manager = r2d2_sqlite::SqliteConnectionManager; diff --git a/scripts/test.sh b/scripts/test.sh index a606cdc3..2808832b 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -63,7 +63,6 @@ function test_contrib() { diesel_sqlite_pool diesel_mysql_pool postgres_pool - mysql_pool sqlite_pool memcache_pool brotli_compression diff --git a/site/guide/6-state.md b/site/guide/6-state.md index 8971996b..a4490795 100644 --- a/site/guide/6-state.md +++ b/site/guide/6-state.md @@ -229,11 +229,10 @@ Presently, Rocket provides built-in support for the following databases: | Kind | Driver | Version | `Poolable` Type | Feature | |----------|-----------------------|-----------|--------------------------------|------------------------| | MySQL | [Diesel] | `1` | [`diesel::MysqlConnection`] | `diesel_mysql_pool` | -| MySQL | [`rust-mysql-simple`] | `18` | [`mysql::Conn`] | `mysql_pool` | | Postgres | [Diesel] | `1` | [`diesel::PgConnection`] | `diesel_postgres_pool` | | Postgres | [Rust-Postgres] | `0.19` | [`postgres::Client`] | `postgres_pool` | | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | -| Sqlite | [`Rusqlite`] | `0.23` | [`rusqlite::Connection`] | `sqlite_pool` | +| Sqlite | [`Rusqlite`] | `0.24` | [`rusqlite::Connection`] | `sqlite_pool` | | Memcache | [`memcache`] | `0.15` | [`memcache::Client`] | `memcache_pool` | [`r2d2`]: https://crates.io/crates/r2d2 @@ -242,11 +241,9 @@ Presently, Rocket provides built-in support for the following databases: [`diesel::SqliteConnection`]: https://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html [`postgres::Client`]: https://docs.rs/postgres/0.19/postgres/struct.Client.html [`diesel::PgConnection`]: https://docs.diesel.rs/diesel/pg/struct.PgConnection.html -[`mysql::Conn`]: https://docs.rs/mysql/18/mysql/struct.Conn.html [`diesel::MysqlConnection`]: https://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html [`Rusqlite`]: https://github.com/jgallagher/rusqlite [Rust-Postgres]: https://github.com/sfackler/rust-postgres -[`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple [`diesel::PgConnection`]: https://docs.diesel.rs/diesel/pg/struct.PgConnection.html [`memcache`]: https://github.com/aisk/rust-memcache [`memcache::Client`]: https://docs.rs/memcache/0.15/memcache/struct.Client.html