Skip to content

Commit bf62fd0

Browse files
committed
Implementing persistence to SQLite
1 parent 246234e commit bf62fd0

File tree

13 files changed

+1170
-90
lines changed

13 files changed

+1170
-90
lines changed

Cargo.lock

Lines changed: 652 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ tracing-subscriber = "0.3.16"
169169
tui-term = { version = "=0.1.9", default-features = false }
170170
url = "2.2.2"
171171
urlencoding = "2.1.2"
172+
uuid = { version = "1.5.0", features = ["v4"] }
172173
webbrowser = "0.8.7"
173174
which = "4.4.0"
174175
unicode-segmentation = "1.10.1"

crates/turborepo-analytics/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ tokio = { workspace = true, features = ["full", "time"] }
1616
tracing = { workspace = true }
1717
turborepo-api-client = { workspace = true }
1818
turborepo-vercel-api = { workspace = true }
19-
uuid = { version = "1.5.0", features = ["v4"] }
19+
uuid = { workspace = true, features = ["v4"] }

crates/turborepo-api-client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ turborepo-vercel-api-mock = { workspace = true }
2222
workspace = true
2323

2424
[dependencies]
25+
async-graphql = { workspace = true }
2526
bytes.workspace = true
2627
chrono = { workspace = true, features = ["serde"] }
2728
lazy_static = { workspace = true }

crates/turborepo-db/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "turborepo-db"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
async-graphql = "7.0.7"
8+
camino = { workspace = true }
9+
chrono = { workspace = true }
10+
serde_json = { workspace = true }
11+
sqlx = { version = "0.8.3", features = ["runtime-tokio", "sqlite", "chrono"] }
12+
tempfile = { workspace = true }
13+
thiserror = { workspace = true }
14+
tokio = { workspace = true, features = ["full"] }
15+
turbopath = { workspace = true }
16+
turborepo-api-client = { workspace = true }
17+
uuid = { workspace = true, features = ["v4"] }
18+
19+
[dev-dependencies]
20+
anyhow = { workspace = true }
21+
22+
[build-dependencies]
23+
dotenvy = "0.15.7"
24+
25+
[lints]
26+
workspace = true
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
CREATE TABLE IF NOT EXISTS runs (
2+
id INTEGER PRIMARY KEY AUTOINCREMENT,
3+
start_time TEXT NOT NULL,
4+
end_time TEXT,
5+
exit_code INTEGER,
6+
command TEXT NOT NULL,
7+
package_inference_root TEXT,
8+
git_branch TEXT,
9+
git_sha TEXT,
10+
turbo_version TEXT NOT NULL,
11+
full_turbo BOOLEAN
12+
);
13+
14+
CREATE TABLE IF NOT EXISTS config (
15+
id INTEGER PRIMARY KEY AUTOINCREMENT,
16+
api_url TEXT NOT NULL,
17+
login_url TEXT NOT NULL,
18+
team_slug TEXT NOT NULL,
19+
team_id TEXT NOT NULL,
20+
signature BOOLEAN NOT NULL,
21+
preflight BOOLEAN NOT NULL,
22+
timeout INTEGER NOT NULL,
23+
upload_timeout INTEGER NOT NULL,
24+
enabled BOOLEAN NOT NULL,
25+
spaces_id TEXT NOT NULL,
26+
global_dependencies TEXT NOT NULL,
27+
global_env TEXT NOT NULL,
28+
global_pass_through_env TEXT NOT NULL,
29+
tasks TEXT NOT NULL,
30+
cache_dir TEXT NOT NULL,
31+
root_turbo_json TEXT NOT NULL
32+
);
33+
34+
CREATE TABLE IF NOT EXISTS packages (
35+
id INTEGER PRIMARY KEY AUTOINCREMENT,
36+
name TEXT NOT NULL,
37+
path TEXT NOT NULL
38+
);
39+
40+
CREATE TABLE IF NOT EXISTS package_dependencies (
41+
id INTEGER PRIMARY KEY AUTOINCREMENT,
42+
dependent_id INTEGER NOT NULL,
43+
dependency_id INTEGER NOT NULL
44+
);
45+
46+
CREATE TABLE IF NOT EXISTS tasks (
47+
id INTEGER PRIMARY KEY AUTOINCREMENT,
48+
run_id TEXT NOT NULL,
49+
name TEXT NOT NULL,
50+
hash TEXT NOT NULL,
51+
package_id INTEGER NOT NULL,
52+
start_time TEXT NOT NULL,
53+
end_time TEXT,
54+
cache_status TEXT,
55+
exit_code INTEGER,
56+
logs TEXT
57+
);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE TABLE IF NOT EXISTS package_relations (
2+
id INTEGER PRIMARY KEY AUTOINCREMENT,
3+
dependent_package_id INTEGER NOT NULL,
4+
dependency_package_id INTEGER NOT NULL
5+
);
6+
7+
CREATE TABLE IF NOT EXISTS task_relations (
8+
id INTEGER PRIMARY KEY AUTOINCREMENT,
9+
dependent_task_id INTEGER NOT NULL,
10+
dependency_task_id INTEGER NOT NULL
11+
);

0 commit comments

Comments
 (0)