Run 'cargo fmt' to format code (#489)
This commit is contained in:
committed by
Baptiste Gelez
parent
732f514da7
commit
b945d1f602
@@ -1,4 +1,6 @@
|
||||
use diesel::{r2d2::{ConnectionManager, CustomizeConnection, Error as ConnError, Pool, PooledConnection}};
|
||||
use diesel::r2d2::{
|
||||
ConnectionManager, CustomizeConnection, Error as ConnError, Pool, PooledConnection,
|
||||
};
|
||||
#[cfg(feature = "sqlite")]
|
||||
use diesel::{dsl::sql_query, ConnectionError, RunQueryDsl};
|
||||
use rocket::{
|
||||
@@ -47,8 +49,13 @@ pub struct PragmaForeignKey;
|
||||
impl CustomizeConnection<Connection, ConnError> for PragmaForeignKey {
|
||||
#[cfg(feature = "sqlite")] // will default to an empty function for postgres
|
||||
fn on_acquire(&self, conn: &mut Connection) -> Result<(), ConnError> {
|
||||
sql_query("PRAGMA foreign_keys = on;").execute(conn)
|
||||
sql_query("PRAGMA foreign_keys = on;")
|
||||
.execute(conn)
|
||||
.map(|_| ())
|
||||
.map_err(|_| ConnError::ConnectionError(ConnectionError::BadConnection(String::from("PRAGMA foreign_keys = on failed"))))
|
||||
.map_err(|_| {
|
||||
ConnError::ConnectionError(ConnectionError::BadConnection(String::from(
|
||||
"PRAGMA foreign_keys = on failed",
|
||||
)))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user