Story: Database naming refactor
Table of Contents
This page documents a story in Sprint 09. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
Make ownership of every SQL object explicit by prefixing it with the
component, and use the moment to rename ores.risk to ores.refdata
to reflect what the component actually does.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 09 |
| Now | Completed 2026-01-14. |
| Waiting on | None. |
| Next | None. |
| Last touched | 2026-01-14 |
Acceptance
ores.riskrenamed toores.refdataconsistently.- Every SQL object follows
<component>_<entity>_<suffix>. - C++
tablenameconstants synchronised. sql-schema-creatordocs extended.
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Rename ores.risk to ores.refdata | DONE | 2026-05-19 | 2026-01-14 | Pure rename: include paths, namespaces, CMake targets, header guards, HTTP routes file (risk_routes.cpp -> refdata_routes.cpp); diagrams + docs aligned. |
| Prefix database entities with component | DONE | 2026-05-19 | 2026-01-14 | All SQL tables/functions/triggers/rules follow {component}_{entity}_{suffix}: iam_, refdata_, assets_, telemetry_, geo_, variability_, utility_; entity suffixes _tbl, _fn, _trg, _rule, _idx, _uniq_idx, _gist_idx. C++ tablename constants updated. |
Decisions
- Rename before prefix
- the rename had to land first so the new prefix tree (
refdata_) was correct from the start. - Prefix + suffix together
<component>_<entity>_<suffix>carries both ownership and object kind in the name; no need to grep schema metadata.
Out of scope
- Postgres role naming convention (already covered).
- Schema-per-component (single
oresschema is sufficient at this scale).
See also
- ores.sql — the component this story restructures.