diff options
Diffstat (limited to 'filamento/src/db.rs')
-rw-r--r-- | filamento/src/db.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/filamento/src/db.rs b/filamento/src/db.rs index d2c24a2..e560443 100644 --- a/filamento/src/db.rs +++ b/filamento/src/db.rs @@ -55,9 +55,21 @@ impl Db { } #[cfg(target_arch = "wasm32")] + pub async fn create_connect_and_migrate_memory() -> Result<Self, DatabaseOpenError> { + let db = Connection::open("mem.db")?; + db.execute_batch(include_str!("../migrations/1.sql"))?; + Ok(Self { + db: Arc::new(Mutex::new(db)), + }) + } + + #[cfg(target_arch = "wasm32")] pub async fn create_connect_and_migrate( path: impl AsRef<Path>, ) -> Result<Self, DatabaseOpenError> { + // rusqlite::ffi::install_opfs_sahpool(Some(&rusqlite::ffi::OpfsSAHPoolCfg::default()), true) + // .await + // .unwrap(); let db = Connection::open(path)?; db.execute_batch(include_str!("../migrations/1.sql"))?; Ok(Self { |