summaryrefslogtreecommitdiffstats
path: root/src/db/migrations.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/migrations.rs')
-rw-r--r--src/db/migrations.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/db/migrations.rs b/src/db/migrations.rs
index 8ba925c..bb8974f 100644
--- a/src/db/migrations.rs
+++ b/src/db/migrations.rs
@@ -299,6 +299,26 @@ BEGIN
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.
+const M_0007_STAGE_B_CACHE: &str = r#"
+CREATE TABLE stage_b_cache (
+ pkgbase_id INTEGER NOT NULL REFERENCES pkgbase(id),
+ recipe_hash TEXT NOT NULL,
+ tip_hash TEXT NOT NULL,
+ epoch TEXT NOT NULL,
+ pkgver TEXT NOT NULL,
+ pkgrel TEXT NOT NULL,
+ pins_json TEXT NOT NULL,
+ resolved_at TEXT NOT NULL,
+ PRIMARY KEY (pkgbase_id, recipe_hash, tip_hash)
+);
+
+CREATE INDEX stage_b_cache_by_pkgbase ON stage_b_cache (pkgbase_id, resolved_at);
+"#;
+
pub static MIGRATIONS: &[Migration] = &[
Migration { version: 1, name: "core", sql: M_0001_CORE },
Migration { version: 2, name: "build", sql: M_0002_BUILD },
@@ -306,6 +326,7 @@ pub static MIGRATIONS: &[Migration] = &[
Migration { version: 4, name: "audit-triggers", sql: M_0004_TRIGGERS },
Migration { version: 5, name: "artifact-build", sql: M_0005_ARTIFACT_BUILD },
Migration { version: 6, name: "approval-immutable", sql: M_0006_APPROVAL_IMMUTABLE },
+ Migration { version: 7, name: "stage-b-cache", sql: M_0007_STAGE_B_CACHE },
];
/// Default settings seeded into `settings` (DESIGN.md §11).
@@ -314,6 +335,7 @@ pub const DEFAULT_SETTINGS: &[(&str, &str)] = &[
("build_timeout", "5400"),
("poll_interval", "86400"),
("stage_b_cooldown", "86400"),
+ ("stage_b_concurrency", "1"),
("retention_versions", "3"),
("dry_run", "0"),
("review_budget_days", "14"),