maybe fix disappearing db

This commit is contained in:
Adam 2024-05-18 22:12:13 -04:00
parent 6e80a243b7
commit ec2598a2cc

View file

@ -1,7 +1,7 @@
use app::components::api::Article;
use leptos::*;
use serde::*;
use sqlx::*;
use sqlx::{sqlite::SqlitePoolOptions, *};
pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
let _res = query(
@ -18,7 +18,7 @@ pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
.execute(pool)
.await?;
// println!("{:?}", _res);
println!("{:?}", _res);
#[derive(Deserialize)]
struct ArticleFrontmatter {
@ -66,7 +66,7 @@ pub async fn db_build(pool: &SqlitePool) -> Result<(), ServerFnError> {
.execute(pool)
.await?;
// println!("{:?}", _res);
println!("{:?}", _res);
}
}
}
@ -96,9 +96,11 @@ pub async fn start_pool() -> Result<SqlitePool, ServerFnError> {
db goin up"
);
let pool = SqlitePool::connect("sqlite://doordesk.db").await?;
let pool = SqlitePoolOptions::new()
.connect("file::memory:?cache=shared")
.await?;
let _ = db_build(&pool);
let _ = db_build(&pool).await?;
Ok(pool)
}