diff options
Diffstat (limited to 'src/db/migrations.rs')
| -rw-r--r-- | src/db/migrations.rs | 23 |
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; |
