Story: Database schema and seeding overhaul
Table of Contents
This page documents a story in Sprint 08. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
Take the database story from works on my dev box to reproducible from scratch. Make TimescaleDB integration adaptive to the available license tier, centralise seeding in SQL populate scripts, and document the schema.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 08 |
| Now | Completed 2025-12-31. |
| Waiting on | None. |
| Next | None. |
| Last touched | 2025-12-31 |
Acceptance
- Clean-slate schema bring-up succeeds end-to-end.
- Apache vs Timescale license detected at runtime; advanced features gated.
- All seeding lives in SQL; the C++ seeders are gone.
- Schema and component docs land in
doc/andprojects/ores.sql/modeling/.
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Rerun SQL scripts from scratch | DONE | 2026-05-19 | 2025-12-31 | Validate schema bring-up from a clean slate; add TimescaleDB license-tier detection and per-database extension install; document the schema. |
| Remove code seeders; seed from SQL populate scripts | DONE | 2026-05-19 | 2025-12-31 | Replace C++ rbac_seeder and system_flags_seeder with SQL populate scripts; rename sql/data/ to sql/populate/; adapt tests to a pre-seeded database. |
Decisions
- Runtime license detection
- keeps the same binaries usable against both Apache TimescaleDB and the Timescale-licensed build.
- Per-database extension install
- avoids template/database drift when multiple ORES databases coexist on one cluster.
- SQL is the single source of truth for seeding
- removes the dual seed paths that were quietly diverging.
Out of scope
- Postgres major-version upgrade automation.
- Cross-cluster replication.
See also
- ores.sql — the component this story restructures.