db+game: crew table and pure seeded crew generation (starting crew + exploration roll)

This commit is contained in:
2026-09-28 22:42:28 +00:00
parent a6a5e827a1
commit ccd156b7c6
4 changed files with 187 additions and 0 deletions
+10
View File
@@ -61,6 +61,16 @@ CREATE TABLE IF NOT EXISTS inventory_items (
qty INTEGER NOT NULL DEFAULT 1
);
CREATE TABLE IF NOT EXISTS crew (
id INTEGER PRIMARY KEY AUTOINCREMENT,
save_id INTEGER NOT NULL REFERENCES saves(id),
name TEXT NOT NULL,
role TEXT NOT NULL,
trait_good TEXT NOT NULL,
trait_bad TEXT NOT NULL,
origin TEXT NOT NULL -- 'STARTING CREW' or '<planet>, <system>' for members found while exploring
);
CREATE TABLE IF NOT EXISTS events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
save_id INTEGER NOT NULL REFERENCES saves(id),
+13
View File
@@ -58,6 +58,19 @@ export const inventoryItems = sqliteTable('inventory_items', {
qty: integer('qty').notNull().default(1),
})
// The ship's crew roster: the starting crew (seeded on new game) plus members found while
// exploring planets/moons. Display-only for now — no dismiss/assign actions yet (#7 scope).
export const crew = sqliteTable('crew', {
id: integer('id').primaryKey({ autoIncrement: true }),
saveId: integer('save_id').notNull().references(() => saves.id),
name: text('name').notNull(),
role: text('role').notNull(),
traitGood: text('trait_good').notNull(),
traitBad: text('trait_bad').notNull(),
// Where the member came from: 'STARTING CREW' or '<planet>, <system>' for found members.
origin: text('origin').notNull(),
})
// Append-only game log. Writers so far: new-game + jump events; later issues add more
// writers and a read endpoint.
export const events = sqliteTable('events', {