Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesAttribute-to-SQL handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4095bd8 to
c12bc68
Compare
oracle had a branch testing `attribute.type === 'DOUBLE'`, which only matches the raw string, and then called `toSql()` on that string. Reaching it threw a TypeError. A raw string type now falls through to the general branch like every other one. Its self-referential check compared against `references.tableName`, which v7 never sets — it uses `references.table` — so the check never fired. It now goes through `isSameTable`, as mssql's equivalent does. ibmi computed an `attributeString` that both following branches overwrote. Co-Authored-By: Claude Opus 5 <[email protected]>
mssql and oracle cleared onDelete and onUpdate on the caller's attribute for self-referencing columns, and oracle switched off `unsigned` on the shared data type, so a second call with the same type lost its CHECK constraint. Oracle's integer types never render UNSIGNED, so the flag only needs to be read. Co-Authored-By: Claude Opus 5 <[email protected]>
Removes the notes describing behaviour this branch fixed, and corrects two that were wrong: db2 and mssql drop the referential actions of repeated references to the same table on purpose, because both servers reject more than one cascading constraint to a table. Only db2's extra rule for unique attributes has no known justification, so that one keeps a TODO. Co-Authored-By: Claude Opus 5 <[email protected]>
c12bc68 to
6b35400
Compare
Description of Changes
Fourth of the stack re-implementing #17121, stacked on #18400.
The per-dialect bugs that are left once the defaults (18427) and the options contract (#18400) are fixed. Each was verified against a real server rather than from reading the source, where a server was available.
Replaces #18402, which GitHub closed as merged when the stack was reordered — the branch and its commits are unchanged, nothing landed on
main.fix(ibmi,oracle): correct two per-dialect attributeToSQL bugsoracle had two branches that could never have worked:
else if (attribute.type && attribute.type === 'DOUBLE')only matches the raw string'DOUBLE', and then calls.toSql()on it, which a string does not have. Reaching it threw aTypeError.DataTypes.DOUBLErenders asBINARY_DOUBLEorDOUBLE PRECISIONand never takes this path. A raw string type now falls through to the general branch like every other one.Model.tableNameagainstreferences.tableName, but v7 references usereferences.table, so the comparison was always againstundefinedand the check never fired. It now goes throughisSameTable, as mssql's equivalent already does.ibmi computed an
attributeStringthat both following branches overwrote.fix(mssql,oracle): stop attributeToSQL from modifying its inputBoth cleared
onDelete/onUpdateon the caller's attribute object for self-referencing columns — oracle's check only started firing with the fix above. oracle also setunsignedtofalseon the shared data type, so a second call with the same type silently lost itsCHECK (... >= 0).Both now work on a copy. Oracle's integer types never render
UNSIGNED, so the flag only needs to be read. Two regression tests pin it: one asserts the attribute is unchanged after the call, the other that the same data type produces the same SQL twice.meta: update the pinned TODOs to match what is still brokenRemoves the notes describing behaviour this stack fixed, and corrects two that were wrong: db2 and mssql drop the referential actions of repeated references to the same table on purpose, because both servers reject more than one cascading constraint to a table. Only db2's extra rule for unique attributes has no known justification, so that one keeps a TODO.
Not changed, and why
attribute.comment— SQLite has noCOMMENTsyntax at all, so there is nothing to emit. Not a bug.COMMENTmarker already escapes it. Escaping at the source (as fix: overhaul test suite ofattribute(s)ToSQL#17121 does) would double-escape, and is what caused that PR to leakN'FooBar'intodescribeTable. Keeps a TODO.Verification
All nine dialect unit suites pass at every commit in this PR, with clean
eslint, cleanprettier, and cleantscon both--noEmitandtest/tsconfig.json. Integration suites for the stack as a whole run against real servers: mssql 411 passing, oracle 388 passing (needsTZ=UTC), db2 19 passing on the query-interface suite. Oracle needsTZ=UTC; four timestamp tests otherwise fail on a host in CEST, unrelated to this change. ibmi remains unverified.List of Breaking Changes
None. oracle's self-referential-constraint warning now actually fires, which means a self-referencing column loses its
ON DELETEclause as the code always intended.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests