Fixed init-db error
This commit is contained in:
+6
-2
@@ -11,11 +11,15 @@ pub struct User {
|
|||||||
|
|
||||||
// Initialize SQLite connection pool
|
// Initialize SQLite connection pool
|
||||||
pub async fn init_db() -> SqlitePool {
|
pub async fn init_db() -> SqlitePool {
|
||||||
let pool = SqlitePool::connect("sqlite:users.db").await.unwrap();
|
let pool = SqlitePool::connect("sqlite://users.db?mode=rwc")
|
||||||
|
.await
|
||||||
|
.expect("Failed to open database");
|
||||||
|
|
||||||
sqlx::query(include_str!("schema.sql"))
|
sqlx::query(include_str!("schema.sql"))
|
||||||
.execute(&pool)
|
.execute(&pool)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.expect("Failed to run schema");
|
||||||
|
|
||||||
pool
|
pool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user