Found while correcting docs for #11431. Filed unassigned. Pre-existing — not falsified by that diff, so out of scope for its PR.
What
content/docs/protocol/objectql/types.mdx, in the footnote under the Type Conversion Matrix, states:
Relationship columns are plain id strings with no database FOREIGN KEY constraint (see lookup above).
createColumn in packages/drivers/driver-sql/src/sql-driver.ts does emit one:
case'lookup':
case'user':
col=table.string(name);if(field.reference_to){table.foreign(name).references('id').inTable(field.reference_to);}Evidence
Measured on live MySQL 8.0.46 while testing something else: a child column declared against a parent id produces a real CONSTRAINT … FOREIGN KEY in information_schema, and Postgres 16 the same. The constraint is emitted whenever the field carries reference_to.
Why it matters
The sentence reads as a deliberate architectural statement — the kind an author relies on when reasoning about delete behaviour, load order, and whether a cross-datasource lookup is possible. If the true story is "an FK is emitted when reference_to is set, and not when it is absent", that is a materially different contract, and the conditional is the interesting half.
⚠️ Worth checking which spelling actually reaches the driver before writing the correction: the docs and the spec use reference, while this branch reads reference_to. If the authored key is normalised to reference somewhere upstream, this branch may be emitting no FK for ordinary authored lookups at all — in which case the doc is accidentally right and the DRIVER carries a dead branch. Either way one of the two is wrong; measuring which is the first step, not the correction.
Generated by Claude Code
Found while correcting docs for #11431. Filed unassigned. Pre-existing — not falsified by that diff, so out of scope for its PR.
What
content/docs/protocol/objectql/types.mdx, in the footnote under the Type Conversion Matrix, states:createColumninpackages/drivers/driver-sql/src/sql-driver.tsdoes emit one:Evidence
Measured on live MySQL 8.0.46 while testing something else: a child column declared against a parent
idproduces a realCONSTRAINT … FOREIGN KEYininformation_schema, and Postgres 16 the same. The constraint is emitted whenever the field carriesreference_to.Why it matters
The sentence reads as a deliberate architectural statement — the kind an author relies on when reasoning about delete behaviour, load order, and whether a cross-datasource lookup is possible. If the true story is "an FK is emitted when
reference_tois set, and not when it is absent", that is a materially different contract, and the conditional is the interesting half.reference, while this branch readsreference_to. If the authored key is normalised toreferencesomewhere upstream, this branch may be emitting no FK for ordinary authored lookups at all — in which case the doc is accidentally right and the DRIVER carries a dead branch. Either way one of the two is wrong; measuring which is the first step, not the correction.Generated by Claude Code