fix(db): keep router_profile through the legacy lanes rebuild
The (cwd, tool) rebuild lists its columns by hand and omitted router_profile, which its probe adds earlier in the same start — a legacy DB lost the column (and every lane's router) until the next restart.
This commit is contained in:
@@ -85,6 +85,17 @@ describe("legacy lanes_new rebuild (pre-tool, single-column cwd UNIQUE DB)", ()
|
||||
assert.equal(row.tool, "claude");
|
||||
});
|
||||
|
||||
it("keeps every column added before the rebuild, router_profile included", () => {
|
||||
const { db } = require("../db");
|
||||
const cols = db
|
||||
.prepare("PRAGMA table_info(lanes)")
|
||||
.all()
|
||||
.map((c) => c.name);
|
||||
for (const name of ["router_profile", "needs_action_session"]) {
|
||||
assert.ok(cols.includes(name), `expected ${name} to survive the rebuild`);
|
||||
}
|
||||
});
|
||||
|
||||
it("recreates idx_lanes_session and idx_lanes_slot", () => {
|
||||
const { db } = require("../db");
|
||||
for (const name of ["idx_lanes_session", "idx_lanes_slot"]) {
|
||||
|
||||
+4
-1
@@ -645,6 +645,8 @@ try {
|
||||
db.exec(`
|
||||
PRAGMA foreign_keys = OFF;
|
||||
BEGIN;
|
||||
-- Every column the probes ABOVE this block add must be listed here too,
|
||||
-- or the rebuild silently drops it (router_profile once was).
|
||||
CREATE TABLE lanes_new (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
title TEXT NOT NULL DEFAULT '',
|
||||
@@ -669,6 +671,7 @@ try {
|
||||
base_branch TEXT,
|
||||
slug TEXT,
|
||||
tool TEXT NOT NULL DEFAULT 'claude',
|
||||
router_profile TEXT,
|
||||
detected_stage TEXT,
|
||||
detected_signal TEXT,
|
||||
detected_at TEXT,
|
||||
@@ -679,7 +682,7 @@ try {
|
||||
INSERT INTO lanes_new SELECT
|
||||
id, title, cwd, branch, pipeline, session_id, run_id, stage, stage_since,
|
||||
status, gate_decision, ci_status, needs_action, links, stages, notes,
|
||||
created_at, updated_at, kind, source_repo, base_branch, slug, tool,
|
||||
created_at, updated_at, kind, source_repo, base_branch, slug, tool, router_profile,
|
||||
detected_stage, detected_signal, detected_at, slot, ports, active_feature_id
|
||||
FROM lanes;
|
||||
DROP TABLE lanes;
|
||||
|
||||
Reference in New Issue
Block a user