Archived
1
0
Fork 0

chore: don't support rusqlite feature name

This commit is contained in:
Dmitriy Pleshevskiy 2021-05-23 13:35:11 +03:00
parent 0633780b84
commit 1d4f089e77
4 changed files with 15 additions and 15 deletions

View file

@ -28,7 +28,7 @@ fn recursive_find_project_root() -> MigraResult<PathBuf> {
#[cfg(any( #[cfg(any(
not(feature = "postgres"), not(feature = "postgres"),
not(feature = "mysql"), not(feature = "mysql"),
not(any(feature = "sqlite", feature = "rusqlite")) not(feature = "sqlite")
))] ))]
macro_rules! please_install_with { macro_rules! please_install_with {
(feature $database_name:expr) => { (feature $database_name:expr) => {
@ -57,7 +57,7 @@ pub(crate) enum SupportedDatabaseClient {
Postgres, Postgres,
#[cfg(feature = "mysql")] #[cfg(feature = "mysql")]
Mysql, Mysql,
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
Sqlite, Sqlite,
} }
@ -68,7 +68,7 @@ impl Default for SupportedDatabaseClient {
SupportedDatabaseClient::Postgres SupportedDatabaseClient::Postgres
} else if #[cfg(feature = "mysql")] { } else if #[cfg(feature = "mysql")] {
SupportedDatabaseClient::Mysql SupportedDatabaseClient::Mysql
} else if #[cfg(any(feature = "sqlite", feature = "rusqlite"))] { } else if #[cfg(feature = "sqlite")] {
SupportedDatabaseClient::Sqlite SupportedDatabaseClient::Sqlite
} }
} }
@ -116,7 +116,7 @@ impl DatabaseConfig {
} }
} else if connection_string.ends_with(".db") { } else if connection_string.ends_with(".db") {
cfg_if! { cfg_if! {
if #[cfg(any(feature = "sqlite", feature = "rusqlite"))] { if #[cfg(feature = "sqlite")] {
Some(SupportedDatabaseClient::Sqlite) Some(SupportedDatabaseClient::Sqlite)
} else { } else {
please_install_with!(feature "sqlite") please_install_with!(feature "sqlite")

View file

@ -13,7 +13,7 @@ cfg_if! {
} }
cfg_if! { cfg_if! {
if #[cfg(any(feature = "sqlite", feature = "rusqlite"))] { if #[cfg(feature = "sqlite")] {
mod sqlite; mod sqlite;
pub use self::sqlite::*; pub use self::sqlite::*;
} }

View file

@ -44,7 +44,7 @@ impl DatabaseConnectionManager {
} }
#[cfg(feature = "mysql")] #[cfg(feature = "mysql")]
SupportedDatabaseClient::Mysql => Box::new(MySqlConnection::open(&connection_string)?), SupportedDatabaseClient::Mysql => Box::new(MySqlConnection::open(&connection_string)?),
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
SupportedDatabaseClient::Sqlite => { SupportedDatabaseClient::Sqlite => {
Box::new(SqliteConnection::open(&connection_string)?) Box::new(SqliteConnection::open(&connection_string)?)
} }

View file

@ -161,7 +161,7 @@ Pending migrations:
#[cfg(feature = "mysql")] #[cfg(feature = "mysql")]
inner(MYSQL_URL)?; inner(MYSQL_URL)?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| inner(SQLITE_URL))?; remove_sqlite_db().and_then(|_| inner(SQLITE_URL))?;
Ok(()) Ok(())
@ -239,7 +239,7 @@ Pending migrations:
#[cfg(feature = "mysql")] #[cfg(feature = "mysql")]
inner("mysql")?; inner("mysql")?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| inner("sqlite"))?; remove_sqlite_db().and_then(|_| inner("sqlite"))?;
Ok(()) Ok(())
@ -290,7 +290,7 @@ Pending migrations:
#[cfg(feature = "mysql")] #[cfg(feature = "mysql")]
inner("mysql")?; inner("mysql")?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| inner("sqlite"))?; remove_sqlite_db().and_then(|_| inner("sqlite"))?;
Ok(()) Ok(())
@ -341,7 +341,7 @@ Pending migrations:
#[cfg(feature = "mysql")] #[cfg(feature = "mysql")]
inner("mysql")?; inner("mysql")?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| inner("sqlite"))?; remove_sqlite_db().and_then(|_| inner("sqlite"))?;
Ok(()) Ok(())
@ -404,7 +404,7 @@ mod make {
#[cfg(feature = "mysql")] #[cfg(feature = "mysql")]
inner("mysql")?; inner("mysql")?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| inner("sqlite"))?; remove_sqlite_db().and_then(|_| inner("sqlite"))?;
Ok(()) Ok(())
@ -471,7 +471,7 @@ mod upgrade {
Ok(()) Ok(())
})?; })?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| { remove_sqlite_db().and_then(|_| {
inner("sqlite", || { inner("sqlite", || {
use rusqlite::Connection; use rusqlite::Connection;
@ -527,7 +527,7 @@ mod upgrade {
Ok(()) Ok(())
})?; })?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| { remove_sqlite_db().and_then(|_| {
inner("sqlite_invalid", || { inner("sqlite_invalid", || {
use rusqlite::Connection; use rusqlite::Connection;
@ -579,7 +579,7 @@ mod upgrade {
Ok(()) Ok(())
})?; })?;
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| { remove_sqlite_db().and_then(|_| {
inner("sqlite_invalid", || { inner("sqlite_invalid", || {
use rusqlite::Connection; use rusqlite::Connection;
@ -712,7 +712,7 @@ mod apply {
} }
} }
#[cfg(any(feature = "sqlite", feature = "rusqlite"))] #[cfg(feature = "sqlite")]
remove_sqlite_db().and_then(|_| { remove_sqlite_db().and_then(|_| {
inner( inner(
"sqlite", "sqlite",