MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _create_test_db

Function _create_test_db

tests/test_clear_database.py:12–103  ·  view source on GitHub ↗
(db_path: Path)

Source from the content-addressed store, hash-verified

10
11
12def _create_test_db(db_path: Path) -> None:
13 conn = sqlite3.connect(db_path)
14 cursor = conn.cursor()
15
16 cursor.execute(
17 """
18 CREATE TABLE profiles (
19 id INTEGER PRIMARY KEY AUTOINCREMENT,
20 user_id TEXT UNIQUE NOT NULL,
21 profile_json TEXT NOT NULL,
22 version TEXT NOT NULL,
23 updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
24 )
25 """
26 )
27 cursor.execute(
28 """
29 CREATE TABLE papers (
30 id INTEGER PRIMARY KEY AUTOINCREMENT,
31 arxiv_id TEXT UNIQUE,
32 doi TEXT,
33 title TEXT NOT NULL,
34 authors TEXT,
35 institution TEXT,
36 abstract TEXT,
37 venue TEXT,
38 publish_date DATE,
39 embedding BLOB,
40 embedding_model TEXT,
41 fetched_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
42 pushed BOOLEAN DEFAULT FALSE,
43 push_date DATE
44 )
45 """
46 )
47 cursor.execute(
48 """
49 CREATE TABLE behavior_logs (
50 id INTEGER PRIMARY KEY AUTOINCREMENT,
51 user_id TEXT NOT NULL,
52 push_id TEXT NOT NULL,
53 paper_id INTEGER,
54 action TEXT NOT NULL,
55 action_type TEXT NOT NULL,
56 category TEXT,
57 timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
58 metadata TEXT,
59 FOREIGN KEY (paper_id) REFERENCES papers(id)
60 )
61 """
62 )
63 cursor.execute(
64 """
65 CREATE TABLE task_status (
66 id INTEGER PRIMARY KEY AUTOINCREMENT,
67 task_id TEXT UNIQUE NOT NULL,
68 task_type TEXT NOT NULL,
69 user_id TEXT,

Calls 3

cursorMethod · 0.80
executeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected