Skip to content

feat: implementing persistence with sqlite #9077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
737 changes: 652 additions & 85 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ tracing-subscriber = "0.3.16"
tui-term = { version = "=0.1.9", default-features = false }
url = "2.2.2"
urlencoding = "2.1.2"
uuid = { version = "1.5.0", features = ["v4"] }
webbrowser = "0.8.7"
which = "4.4.0"
unicode-segmentation = "1.10.1"
2 changes: 1 addition & 1 deletion crates/turborepo-analytics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ tokio = { workspace = true, features = ["full", "time"] }
tracing = { workspace = true }
turborepo-api-client = { workspace = true }
turborepo-vercel-api = { workspace = true }
uuid = { version = "1.5.0", features = ["v4"] }
uuid = { workspace = true, features = ["v4"] }
1 change: 1 addition & 0 deletions crates/turborepo-api-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ turborepo-vercel-api-mock = { workspace = true }
workspace = true

[dependencies]
async-graphql = { workspace = true }
bytes.workspace = true
chrono = { workspace = true, features = ["serde"] }
lazy_static = { workspace = true }
Expand Down
26 changes: 26 additions & 0 deletions crates/turborepo-db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "turborepo-db"
version = "0.1.0"
edition = "2021"

[dependencies]
async-graphql = "7.0.7"
camino = { workspace = true }
chrono = { workspace = true }
serde_json = { workspace = true }
sqlx = { version = "0.8.3", features = ["runtime-tokio", "sqlite", "chrono"] }
tempfile = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }
turbopath = { workspace = true }
turborepo-api-client = { workspace = true }
uuid = { workspace = true, features = ["v4"] }

[dev-dependencies]
anyhow = { workspace = true }

[build-dependencies]
dotenvy = "0.15.7"

[lints]
workspace = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
CREATE TABLE IF NOT EXISTS runs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
start_time TEXT NOT NULL,
end_time TEXT,
exit_code INTEGER,
command TEXT NOT NULL,
package_inference_root TEXT,
git_branch TEXT,
git_sha TEXT,
turbo_version TEXT NOT NULL,
full_turbo BOOLEAN
);

CREATE TABLE IF NOT EXISTS config (
id INTEGER PRIMARY KEY AUTOINCREMENT,
api_url TEXT NOT NULL,
login_url TEXT NOT NULL,
team_slug TEXT NOT NULL,
team_id TEXT NOT NULL,
signature BOOLEAN NOT NULL,
preflight BOOLEAN NOT NULL,
timeout INTEGER NOT NULL,
upload_timeout INTEGER NOT NULL,
enabled BOOLEAN NOT NULL,
spaces_id TEXT NOT NULL,
global_dependencies TEXT NOT NULL,
global_env TEXT NOT NULL,
global_pass_through_env TEXT NOT NULL,
tasks TEXT NOT NULL,
cache_dir TEXT NOT NULL,
root_turbo_json TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS packages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
path TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS package_dependencies (
id INTEGER PRIMARY KEY AUTOINCREMENT,
dependent_id INTEGER NOT NULL,
dependency_id INTEGER NOT NULL
);

CREATE TABLE IF NOT EXISTS tasks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
run_id TEXT NOT NULL,
name TEXT NOT NULL,
hash TEXT NOT NULL,
package_id INTEGER NOT NULL,
start_time TEXT NOT NULL,
end_time TEXT,
cache_status TEXT,
exit_code INTEGER,
logs TEXT
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE IF NOT EXISTS package_relations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
dependent_package_id INTEGER NOT NULL,
dependency_package_id INTEGER NOT NULL
);

CREATE TABLE IF NOT EXISTS task_relations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
dependent_task_id INTEGER NOT NULL,
dependency_task_id INTEGER NOT NULL
);
Loading
Loading