summaryrefslogtreecommitdiffstats
path: root/src/db/migrations.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
commite757979f1a2afdbe7146066345bb9acd19d3b151 (patch)
tree30d5f5fbccd25ea7bf01c5202684af463b74e7d3 /src/db/migrations.rs
parent94c318f13264bb3c00a9f3057ba2e1aafb57c9e4 (diff)
downloadaur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.tar.gz
aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.zip
comments: say why, not what
Every module-level `//!` header is gone, and the comments that remained either re-explained the line below them or had grown into paragraphs. Density went from one comment line per 6.7 lines of code to one per 10. 827 insertions against 2194 deletions across 86 files. What survived: the invariants (I1-I12), the design cross-references into DESIGN.md, and the notes recording a bug that was found and fixed — those are the comments that carry weight, because they answer a question the code cannot answer about itself. What did not: restating a function signature in prose, and narration of the statement underneath.
Diffstat (limited to 'src/db/migrations.rs')
-rw-r--r--src/db/migrations.rs23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/db/migrations.rs b/src/db/migrations.rs
index 9e60132..b1954ab 100644
--- a/src/db/migrations.rs
+++ b/src/db/migrations.rs
@@ -1,9 +1,3 @@
-//! Hand-rolled `user_version` migration stepper (DESIGN.md §4, "Migrations").
-//!
-//! Each entry is applied inside its own transaction and bumps
-//! `PRAGMA user_version`. Migrations must never be edited after they ship; add
-//! a new one instead.
-
/// One migration: version number + SQL body.
pub struct Migration {
pub version: u32,
@@ -300,9 +294,8 @@ END;
"#;
/// Stage B results, keyed on `(pkgbase, recipe_hash, upstream_tip)` (§5.2).
-/// Re-resolving means cloning an upstream repo and running makepkg, so the
-/// answer is worth keeping; the same key also implements the per-pkgbase
-/// cooldown, because a fresh tip inside the window reuses the old answer.
+/// Re-resolving means cloning an upstream repo and running makepkg, so the answer
+/// is worth keeping; the same key also implements the per-pkgbase cooldown.
const M_0007_STAGE_B_CACHE: &str = r#"
CREATE TABLE stage_b_cache (
pkgbase_id INTEGER NOT NULL REFERENCES pkgbase(id),
@@ -319,14 +312,10 @@ CREATE TABLE stage_b_cache (
CREATE INDEX stage_b_cache_by_pkgbase ON stage_b_cache (pkgbase_id, resolved_at);
"#;
-/// Retention (§15, open question 21). The rows are never compacted — the whole
-/// point of the schema is that "which bytes produced this installed package"
-/// stays answerable — but the bytes on disk cannot be kept forever. So eviction
-/// is recorded rather than implied: the artifact row keeps its digest, size and
-/// provenance and gains a `purged_at`, which says "these bytes existed, and were
-/// dropped from the store at T" instead of silently pretending they are still
-/// there. A `cp` of the store and a database that disagrees about what is on disk
-/// is the failure mode this avoids.
+/// Retention (§15). The rows are never compacted — the schema exists so "which
+/// bytes produced this installed package" stays answerable — but the bytes on disk
+/// cannot be kept forever. So eviction is recorded rather than implied: the
+/// artifact row keeps its digest, size and provenance and gains a `purged_at`.
const M_0008_RETENTION: &str = r#"
ALTER TABLE artifact ADD COLUMN purged_at TEXT;