star-map.json now only carries topology fields (system_id, astronomical_id, gate_topology, aperture/connections, hop distance) plus edges. All per-system data lives in wiki frontmatter. Added Sol as S-000/GJ 0 connected to Gateway. Added star_systems table to schema for wiki sync mirror. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
202 lines
6.9 KiB
SQL
202 lines
6.9 KiB
SQL
-- Settled Reach Project Ticketing Database Schema
|
|
-- Access via: python3 tooling/db/sqlite_connector.py <command>
|
|
-- DO NOT use sqlite3 CLI (crashes in Claude Code due to std::bad_alloc bug)
|
|
|
|
PRAGMA journal_mode=WAL;
|
|
PRAGMA foreign_keys=ON;
|
|
|
|
CREATE TABLE IF NOT EXISTS tickets (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
type TEXT NOT NULL CHECK(type IN ('initiative', 'epic', 'story', 'task', 'bug')),
|
|
parent_id INTEGER REFERENCES tickets(id),
|
|
title TEXT NOT NULL,
|
|
description TEXT,
|
|
status TEXT NOT NULL DEFAULT 'backlog' CHECK(status IN ('backlog', 'ready', 'in_progress', 'review', 'done', 'cancelled')),
|
|
priority TEXT DEFAULT 'medium' CHECK(priority IN ('critical', 'high', 'medium', 'low')),
|
|
assigned_to TEXT,
|
|
team TEXT, -- comma-separated team names, e.g. 'server', 'client,server'
|
|
decision_ref TEXT, -- e.g. 'D-010' or 'Q-001'
|
|
sprint_id INTEGER REFERENCES sprints(id),
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS sprints (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
name TEXT NOT NULL,
|
|
goal TEXT,
|
|
start_date TEXT,
|
|
end_date TEXT,
|
|
status TEXT NOT NULL DEFAULT 'planning' CHECK(status IN ('planning', 'active', 'completed', 'cancelled')),
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS ticket_deps (
|
|
blocker_id INTEGER NOT NULL REFERENCES tickets(id),
|
|
blocked_id INTEGER NOT NULL REFERENCES tickets(id),
|
|
PRIMARY KEY (blocker_id, blocked_id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS ticket_history (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
ticket_id INTEGER NOT NULL REFERENCES tickets(id),
|
|
field TEXT NOT NULL,
|
|
old_value TEXT,
|
|
new_value TEXT,
|
|
changed_by TEXT,
|
|
changed_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS ticket_labels (
|
|
ticket_id INTEGER NOT NULL REFERENCES tickets(id),
|
|
label TEXT NOT NULL,
|
|
PRIMARY KEY (ticket_id, label)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_tickets_status ON tickets(status);
|
|
CREATE INDEX IF NOT EXISTS idx_tickets_type ON tickets(type);
|
|
CREATE INDEX IF NOT EXISTS idx_tickets_parent ON tickets(parent_id);
|
|
CREATE INDEX IF NOT EXISTS idx_tickets_sprint ON tickets(sprint_id);
|
|
CREATE INDEX IF NOT EXISTS idx_tickets_assigned ON tickets(assigned_to);
|
|
CREATE INDEX IF NOT EXISTS idx_tickets_decision ON tickets(decision_ref);
|
|
CREATE INDEX IF NOT EXISTS idx_tickets_team ON tickets(team);
|
|
CREATE INDEX IF NOT EXISTS idx_history_ticket ON ticket_history(ticket_id);
|
|
|
|
-- ---------------------------------------------------------------------------
|
|
-- Decision Sync Tables
|
|
-- Populated by: python3 tooling/db/decisions_sync.py
|
|
-- Source: decisions/*.md domain files
|
|
-- ---------------------------------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS decisions (
|
|
id TEXT PRIMARY KEY,
|
|
type TEXT NOT NULL CHECK(type IN ('confirmed', 'question', 'rejected')),
|
|
domain TEXT NOT NULL,
|
|
title TEXT NOT NULL,
|
|
status TEXT DEFAULT 'active' CHECK(status IN ('active', 'superseded', 'resolved', 'open')),
|
|
round INTEGER,
|
|
date TEXT,
|
|
file_path TEXT NOT NULL,
|
|
synced_at TEXT DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS decision_refs (
|
|
source_id TEXT NOT NULL REFERENCES decisions(id) ON DELETE CASCADE,
|
|
target_id TEXT NOT NULL REFERENCES decisions(id) ON DELETE CASCADE,
|
|
ref_type TEXT NOT NULL CHECK(ref_type IN ('supersedes', 'references', 'resolves', 'depends_on')),
|
|
note TEXT,
|
|
PRIMARY KEY (source_id, target_id, ref_type)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_decisions_type ON decisions(type);
|
|
CREATE INDEX IF NOT EXISTS idx_decisions_domain ON decisions(domain);
|
|
CREATE INDEX IF NOT EXISTS idx_decisions_status ON decisions(status);
|
|
CREATE INDEX IF NOT EXISTS idx_decision_refs_source ON decision_refs(source_id);
|
|
CREATE INDEX IF NOT EXISTS idx_decision_refs_target ON decision_refs(target_id);
|
|
|
|
-- ---------------------------------------------------------------------------
|
|
-- Star Systems Wiki Mirror
|
|
-- Populated by: python3 tooling/db/wiki_sync.py sync
|
|
-- Source: wiki/star-systems/*/index.md (YAML frontmatter)
|
|
-- ---------------------------------------------------------------------------
|
|
|
|
CREATE TABLE IF NOT EXISTS star_systems (
|
|
-- I. Identity and Location
|
|
system_id TEXT PRIMARY KEY,
|
|
astronomical_id TEXT NOT NULL,
|
|
proper_name TEXT,
|
|
system_name TEXT,
|
|
star_type TEXT,
|
|
geographic_sector TEXT,
|
|
geographic_band TEXT,
|
|
political_zone TEXT,
|
|
|
|
-- II. Physical Character
|
|
habitable_planet_count INTEGER,
|
|
inhabited_planet_count INTEGER,
|
|
asteroid_belt TEXT,
|
|
gas_giant TEXT,
|
|
habitability_profile TEXT,
|
|
|
|
-- III. Gate Infrastructure
|
|
horizon_station INTEGER, -- boolean 0/1
|
|
aperture_count INTEGER,
|
|
gate_connections INTEGER,
|
|
gate_topology TEXT,
|
|
span_gate_network TEXT,
|
|
|
|
-- IV. Settlement History
|
|
settlement_wave TEXT,
|
|
founding_motivation TEXT,
|
|
founding_culture_primary TEXT,
|
|
founding_culture_secondary TEXT,
|
|
cultural_persistence TEXT,
|
|
historical_event TEXT,
|
|
historical_event_age_years INTEGER,
|
|
religious_status TEXT,
|
|
religious_generation_count INTEGER,
|
|
|
|
-- V. Economic Life
|
|
economic_tier TEXT,
|
|
population TEXT,
|
|
economic_base_primary TEXT,
|
|
economic_base_secondary TEXT,
|
|
distribution_index TEXT,
|
|
imprint_access TEXT,
|
|
supply_dependency TEXT,
|
|
|
|
-- VI. Governance
|
|
governance_type TEXT,
|
|
dominant_faction TEXT,
|
|
primary_fault_line TEXT,
|
|
secondary_fault_line TEXT,
|
|
|
|
-- VII. Faction Presence
|
|
assembly_presence TEXT,
|
|
commission_presence TEXT,
|
|
syndic_presence TEXT,
|
|
syndic_type TEXT,
|
|
separatist_presence TEXT,
|
|
separatist_type TEXT,
|
|
institute_presence TEXT,
|
|
guardians_presence TEXT,
|
|
faction_notes TEXT,
|
|
|
|
-- VIII. Cultural Voice
|
|
cultural_register TEXT,
|
|
cultural_register_secondary TEXT,
|
|
ambient_anxiety TEXT,
|
|
local_pride TEXT,
|
|
atmospheric_tone TEXT,
|
|
atmospheric_tone_secondary TEXT,
|
|
active_situation TEXT,
|
|
silence_threshold TEXT,
|
|
silence_topic TEXT,
|
|
|
|
-- IX. Political Character
|
|
earth_alignment TEXT,
|
|
earth_proximity TEXT,
|
|
earth_tension TEXT,
|
|
|
|
-- X. Narrative Profile
|
|
primary_archetype TEXT,
|
|
secondary_archetype TEXT,
|
|
narrative_notable TEXT,
|
|
narrative_hook TEXT,
|
|
generation_priority TEXT,
|
|
|
|
-- XI. Content Notes
|
|
stability_index TEXT,
|
|
system_volatility TEXT,
|
|
cultural_corridor TEXT,
|
|
calibration_note TEXT,
|
|
|
|
synced_at TEXT DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_star_systems_astro ON star_systems(astronomical_id);
|
|
CREATE INDEX IF NOT EXISTS idx_star_systems_sector ON star_systems(geographic_sector);
|
|
CREATE INDEX IF NOT EXISTS idx_star_systems_wave ON star_systems(settlement_wave);
|
|
CREATE INDEX IF NOT EXISTS idx_star_systems_topology ON star_systems(gate_topology);
|
|
CREATE INDEX IF NOT EXISTS idx_star_systems_star_type ON star_systems(star_type);
|