Task: Sync SQL codegen for country
This page documents a task in the Commission: country story. It captures the goal, current status, acceptance, and any notes or results.
Goal
Create the ores.refdata.country_table.org table model, regenerate
refdata_countries_create.sql via sql_schema_create.mustache, and
reconcile until the generated SQL is zero-diff against the hand-written
HEAD — or explicitly document any intentional deviations.
SQL layer only. C++ codegen (core, messaging, Qt) is covered by separate tasks (DFD25563, 8AF11AB2, 7663EB07).
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent story | Commission: country |
| Now | Model created; SQL codegen zero-diff (bar documented deviations). C++ remains hand-written. |
| Waiting on | Nothing. |
| Next | Nothing. |
| Last touched | 2026-06-25 |
Acceptance
projects/ores.refdata/modeling/ores.refdata.country_table.orgexists, following theores.refdata.currency_table.orgshape.codegen generate --model ores.refdata.country_table.org --profile sqlproduces zero semantic diff againstrefdata_countries_create.sql.- Any intentional deviations (index name, security definer placement,
WHERE alignment) are documented in
projects/modeling/country.org.
Plan
Notes
Country has no existing codegen model — it was not part of the original
org-migration that converted existing JSON models. The SQL DDL and C++
are hand-written. Country has entity-specific fields (alpha3_code,
numeric_code, coding_scheme_code, image_id) that may require extensions
to the standard template.
The existing blocked task Bring country under codegen and verify zero-diff regeneration was filed earlier in the story; this task supersedes it in scope (it was created before CLI/shell verification split).
PRs
| PR | Title |
|---|---|
| #1312 | [commission_country] Verify shell commands and back out country via codegen |
Review
| Comment summary | File | Decision | Notes |
|---|---|---|---|
Result
| Artefact | Status | Notes |
|---|---|---|
ores.refdata.country_table.org |
CREATED | Table model under projects/ores.refdata/modeling/; follows ores.refdata.currency_table.org shape. |
projects/modeling/country.org |
CREATED | Entity view documenting all artefacts and SQL deviations. |
refdata_countries_create.sql |
GENERATED | Codegen produced zero semantic diff; minor style deviations documented in entity view. |
| C++ artefacts | HAND-WRITTEN | No domain entity org model yet; C++ codegen blocked until that model exists. |
SQL deviations from hand-written to generated form:
- Index renamed
countries_code_uniq_idx→countries_alpha2_code_uniq_idx(template convention) security definerplacement moved from function header to footer (both valid PostgreSQL)- WHERE clause alignment standardised (2-space continuation indent)