cargo update and major upgrade for tokio, refinery

This commit is contained in:
projectmoon 2021-01-17 12:42:45 +00:00
parent 5fd3ef36aa
commit 4980b2e33b
3 changed files with 350 additions and 167 deletions

508
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -32,10 +32,11 @@ rust-argon2 = "0.8"
log = "0.4"
rand = "0.7"
futures = "0.3"
tokio = { version = "0.2", features = ["macros"] }
tokio-compat-02 = "0.2" # Temporary until sqlx 0.5
tokio = { version = "1.0", features = ["macros"] }
strum = { version = "0.20", features = ["derive"] }
sqlx = { version = "0.4.2", features = [ "offline", "sqlite", "runtime-tokio-native-tls" ] }
refinery = { version = "0.3", features = ["rusqlite"]}
refinery = { version = "0.5", features = ["rusqlite"]}
barrel = { version = "0.6", features = ["sqlite3"] }
[dependencies.rocket]

View File

@ -9,10 +9,13 @@ pub type TenebrousDbConn<'a> = rocket::State<'a, SqlitePool>;
/// Create a connection pool to the database.
pub(crate) async fn create_pool(db_path: &str) -> Result<SqlitePool, crate::errors::Error> {
use tokio_compat_02::FutureExt; //Temporary until sqlx 0.5
//Create database if missing.
let conn = SqliteConnectOptions::from_str(&format!("sqlite://{}", db_path))?
.create_if_missing(true)
.connect()
.compat()
.await?;
drop(conn);
@ -21,6 +24,7 @@ pub(crate) async fn create_pool(db_path: &str) -> Result<SqlitePool, crate::erro
SqlitePoolOptions::new()
.max_connections(5)
.connect(db_path)
.compat()
.await
.map_err(|e| e.into())
}