feat(schema): add bodies and stations tables to systems.db

New tables for the celestial body hierarchy below system level:
- bodies: planets, moons, gas giants, asteroid belts, oort clouds
  with physical properties, settlement data, and cultural overrides
- stations: orbital/surface facilities with type, population,
  docking class, and gate infrastructure flag

Naming convention: GJ-{n}b (planet), GJ-{n}b-1 (moon),
GJ-{n}b-S1 (station), GJ-{n}-oort (oort cloud).
Self-referential parent_body_id for moon→planet relationships.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 17:28:40 +01:00
co-authored by Claude Opus 4.6
parent 79a4780c46
commit fc3b7485c6
2 changed files with 73 additions and 0 deletions
Binary file not shown.
+73
View File
@@ -121,6 +121,72 @@ CREATE TABLE IF NOT EXISTS system_culture (
-- narrative_hook, calibration_note) lives in wiki markdown files only.
-- No DB mirror — read the file if you need the text.
-- Celestial bodies — planets, moons, gas giants, asteroid belts, oort clouds
-- Naming convention:
-- GJ-{n}b/c/d... — planets (innermost first)
-- GJ-{n}Ab/c/d... — planets orbiting primary (binary systems)
-- GJ-{n}d-1 — first moon of third planet
-- GJ-{n}-oort — oort cloud region
-- GJ-{n}-belt — asteroid belt
CREATE TABLE IF NOT EXISTS bodies (
body_id TEXT PRIMARY KEY,
system_id TEXT NOT NULL REFERENCES star_systems(system_id),
parent_body_id TEXT REFERENCES bodies(body_id), -- NULL for planets; parent planet for moons
-- Classification
body_type TEXT NOT NULL, -- planet, moon, gas_giant, asteroid_belt, oort_cloud
orbit_index INTEGER, -- innermost = 1 (planets around star, moons around planet)
proper_name TEXT, -- "Xin Chengdu", NULL for unnamed
-- Physical
mass_class TEXT, -- terrestrial, super_earth, ice_giant, gas_giant, dwarf
atmosphere TEXT, -- breathable, thin, toxic, none, dense
surface_gravity REAL, -- in g (Earth = 1.0), NULL for gas giants
biome_summary TEXT, -- temperate, arid, frozen, oceanic, volcanic, barren, mixed
hydrosphere TEXT, -- ocean, ice, rivers, none, subsurface
-- Settlement
inhabited INTEGER NOT NULL DEFAULT 0,
population INTEGER DEFAULT 0,
economic_role TEXT, -- manufacturing, agricultural, extraction, research, transit
founding_age_years INTEGER,
settlement_pattern TEXT, -- urban_concentrated, dispersed_rural, orbital_only, domed, cave
-- Cultural (inherited from system, can override)
cultural_corridor TEXT, -- override system corridor if different
industrial_corridor TEXT, -- MVG, Gate_Corp, DSMC, Prometheus, Agricultural_Syndic
-- Rendering
terrain_reference TEXT, -- heightmap path when authored, NULL otherwise
screenshot_path TEXT, -- planetary shader screenshot path
updated_at TEXT DEFAULT (datetime('now'))
);
-- Stations and orbital facilities
-- Naming: GJ-{n}b-S1 (first station orbiting planet b), GJ-{n}-oort-S1 (horizon station)
CREATE TABLE IF NOT EXISTS stations (
station_id TEXT PRIMARY KEY,
system_id TEXT NOT NULL REFERENCES star_systems(system_id),
orbits_body_id TEXT REFERENCES bodies(body_id),
-- Classification
station_type TEXT NOT NULL, -- horizon, commercial, military, research, industrial, agricultural, transit
proper_name TEXT, -- "Chengdu Orbital", "Horizon Station"
-- Settlement
population INTEGER DEFAULT 0,
economic_role TEXT,
governance_type TEXT, -- can differ from system governance
-- Infrastructure
docking_class TEXT, -- major, standard, restricted, none
has_gate_infrastructure INTEGER DEFAULT 0,
district_count INTEGER DEFAULT 1,
updated_at TEXT DEFAULT (datetime('now'))
);
-- Indexes
-- astronomical_id removed: system_id IS the GJ catalog number
CREATE INDEX IF NOT EXISTS idx_star_systems_sector ON star_systems(geographic_sector);
@@ -132,3 +198,10 @@ CREATE INDEX IF NOT EXISTS idx_historical_events_system ON historical_events(sys
CREATE INDEX IF NOT EXISTS idx_system_factions_dominant ON system_factions(dominant_faction);
CREATE INDEX IF NOT EXISTS idx_system_economy_tier ON system_economy(economic_tier);
CREATE INDEX IF NOT EXISTS idx_system_culture_archetype ON system_culture(primary_archetype);
CREATE INDEX IF NOT EXISTS idx_bodies_system ON bodies(system_id);
CREATE INDEX IF NOT EXISTS idx_bodies_parent ON bodies(parent_body_id);
CREATE INDEX IF NOT EXISTS idx_bodies_type ON bodies(body_type);
CREATE INDEX IF NOT EXISTS idx_bodies_inhabited ON bodies(inhabited);
CREATE INDEX IF NOT EXISTS idx_stations_system ON stations(system_id);
CREATE INDEX IF NOT EXISTS idx_stations_orbits ON stations(orbits_body_id);
CREATE INDEX IF NOT EXISTS idx_stations_type ON stations(station_type);