db+game: tech table + starting tech list seeded on new game and v5 backfill step

This commit is contained in:
2026-09-29 00:20:02 +00:00
parent bd16d3fc47
commit 4ef924edd6
5 changed files with 176 additions and 3 deletions
+13
View File
@@ -81,6 +81,19 @@ CREATE TABLE IF NOT EXISTS ship_systems (
UNIQUE (save_id, type)
);
CREATE TABLE IF NOT EXISTS tech (
id INTEGER PRIMARY KEY AUTOINCREMENT,
save_id INTEGER NOT NULL REFERENCES saves(id),
slug TEXT NOT NULL, -- stable key, e.g. WEAPONS_SYSTEMS
name TEXT NOT NULL, -- display name, e.g. 'WEAPONS SYSTEMS'
cost_kind TEXT NOT NULL, -- 'resource' | 'part'
cost_qty INTEGER NOT NULL DEFAULT 1,
prerequisites TEXT NOT NULL DEFAULT '', -- comma-separated tech slugs, '' when none
effect TEXT NOT NULL, -- effect slug — semantics in EFFECTS (lib/game/tech.ts)
researched INTEGER NOT NULL DEFAULT 0,
UNIQUE (save_id, slug)
);
CREATE TABLE IF NOT EXISTS events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
save_id INTEGER NOT NULL REFERENCES saves(id),