f0fc063756
When the runtime opens a project whose playground.db is missing,
it now rebuilds the database from project.yaml + data/<table>.csv
per ADR-0015 §7. The rebuild path:
1. Parses project.yaml (serde_yml). Unknown versions / types /
actions surface as PersistenceFatal.
2. Recreates each user table with FK constraints inline
(PRAGMA foreign_keys=OFF), then populates the column-type,
relationship, and project metadata tables.
3. Loads each table's CSV via a hand-rolled reader that
preserves the NULL-vs-empty distinction (the csv crate
doesn't expose whether a field was quoted; ours does).
4. Runs PRAGMA foreign_key_check before commit; any violation
aborts.
5. Restores foreign_keys=ON regardless of success.
Row-level failures get DbError::RebuildRowFailed with row
number, file, table, and a friendly per-type detail. They land
in the runtime as a fatal stderr message ("unable to load row N
from `data/T.csv` into table `T`: ...") before the alternate
screen is entered.
created_at from project.yaml overwrites the configure-time
placeholder so timestamps round-trip stably.
Tests: 307 passing (267 lib + 9 + 5 new + 9 + 17), 0 failing,
0 skipped. Clippy clean with nursery lints.
47 lines
1.3 KiB
TOML
47 lines
1.3 KiB
TOML
[package]
|
|
name = "rdbms-playground"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
description = "A cross-platform TUI playground for learning relational databases."
|
|
license = "MIT OR Apache-2.0"
|
|
repository = "https://github.com/sturm/rdbms-playground"
|
|
readme = "README.md"
|
|
publish = false
|
|
|
|
[dependencies]
|
|
anyhow = "1.0.102"
|
|
base64 = "0.22.1"
|
|
chumsky = "0.13.0"
|
|
crossterm = { version = "0.29.0", features = ["event-stream"] }
|
|
csv = "1.4.0"
|
|
directories = "6.0.0"
|
|
futures-util = "0.3.32"
|
|
gethostname = "1.1.0"
|
|
rand = "0.10.1"
|
|
ratatui = "0.30.0"
|
|
rusqlite = { version = "0.39.0", features = ["bundled"] }
|
|
serde = { version = "1.0.228", features = ["derive"] }
|
|
serde_yml = "0.0.12"
|
|
sysinfo = { version = "0.39.0", default-features = false, features = ["system"] }
|
|
thiserror = "2.0.18"
|
|
tokio = { version = "1.52.2", features = ["full"] }
|
|
tracing = "0.1.44"
|
|
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
|
|
|
[dev-dependencies]
|
|
insta = { version = "1.47.2", features = ["yaml"] }
|
|
pretty_assertions = "1.4.1"
|
|
tempfile = "3.27.0"
|
|
|
|
[lints.rust]
|
|
unsafe_code = "forbid"
|
|
unreachable_pub = "warn"
|
|
|
|
[lints.clippy]
|
|
all = { level = "warn", priority = -1 }
|
|
nursery = { level = "warn", priority = -1 }
|
|
# Allow common false-positives that don't materially improve our code.
|
|
module_name_repetitions = "allow"
|
|
missing_errors_doc = "allow"
|
|
missing_panics_doc = "allow"
|