MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / create_raw_db

Function create_raw_db

tests/storage_suite/migration_test.rs:17–34  ·  view source on GitHub ↗

Creates a raw libsql database in a temp directory. Returns (Connection, Database, TempDir) — all three must stay alive.

()

Source from the content-addressed store, hash-verified

15/// Creates a raw libsql database in a temp directory.
16/// Returns (Connection, Database, TempDir) — all three must stay alive.
17async fn create_raw_db() -> (Connection, LibsqlDatabase, TempDir) {
18 let dir = TempDir::new().expect("failed to create temp dir");
19 let db_path = dir.path().join("test.db");
20 let db = Builder::new_local(&db_path)
21 .build()
22 .await
23 .expect("failed to build libsql database");
24 let conn = db.connect().expect("failed to connect");
25 conn.execute_batch(
26 "PRAGMA auto_vacuum = INCREMENTAL;
27 PRAGMA journal_mode = WAL;
28 PRAGMA foreign_keys = ON;
29 PRAGMA busy_timeout = 5000;",
30 )
31 .await
32 .expect("failed to apply pragmas");
33 (conn, db, dir)
34}
35
36/// Opens an existing database file raw, applying the per-connection pragmas
37/// tests rely on (foreign keys for cascade assertions, busy timeout).

Calls 2

buildMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected