Summary
The per-entity table override in .apsorc is silently ignored for at least some entity names: an entity named Order with "table": "order_record" still generates the table as order (snake_case of the entity name) — a SQL reserved word. The override IS honored for other compound-name entities in the same schema, so the failure appears name-specific.
Environment
- @apso/cli 0.19.0
- TypeScript / NestJS / TypeORM target
Repro
.apsorc entity:
Run apso generate.
Expected
The generated entity maps to table order_record (the explicit override).
Actual
The generated entity maps to table order — the override is ignored and the name is snake_cased. order is a SQL reserved word; it only works because TypeORM quotes identifiers via the repository API. Any hand-written raw SQL that forgets to quote "order" breaks.
Impact
- Silently ignoring an explicit
table override is a correctness footgun.
- Landing on a reserved word is a latent hazard for raw queries / migrations / external tooling.
Suggested fix
Honor the explicit per-entity table override; and/or detect reserved words and either auto-quote consistently in generated SQL or refuse with a clear error. A diagnostic when a derived table name is a reserved word would also help.
Workaround
Set table to match what's generated (order) and quote it in any raw SQL.
Summary
The per-entity
tableoverride in.apsorcis silently ignored for at least some entity names: an entity namedOrderwith"table": "order_record"still generates the table asorder(snake_case of the entity name) — a SQL reserved word. The override IS honored for other compound-name entities in the same schema, so the failure appears name-specific.Environment
Repro
.apsorcentity:{ "name": "Order", "table": "order_record", "primaryKeyType": "uuid", "fields": [ ... ] }Run
apso generate.Expected
The generated entity maps to table
order_record(the explicit override).Actual
The generated entity maps to table
order— the override is ignored and the name is snake_cased.orderis a SQL reserved word; it only works because TypeORM quotes identifiers via the repository API. Any hand-written raw SQL that forgets to quote "order" breaks.Impact
tableoverride is a correctness footgun.Suggested fix
Honor the explicit per-entity
tableoverride; and/or detect reserved words and either auto-quote consistently in generated SQL or refuse with a clear error. A diagnostic when a derived table name is a reserved word would also help.Workaround
Set
tableto match what's generated (order) and quote it in any raw SQL.