Repository navigation
fix(designer): stop the form building DDL the server will not take - #550
Merged
Merged
Conversation
Closes #382, #383, #384. Three ways the designer let an invalid or lossy statement be assembled, each surfacing only when the save failed — or, in the first case, not surfacing at all. ## Unknown types became VARCHAR (#382) A type the dropdown did not list was replaced with VARCHAR on load. Editing anything about such a column then rewrote it. Confirmed against MySQL 8: BIT(8) holding b'10101010' -> varchar(8) holding "170" Silent, and the value's meaning changes. A JSON column fared better only by accident: it has no length, so the emitted `VARCHAR` with no width is a syntax error and the save fails loudly. The list is now longer — BIT, BOOL, SERIAL, the BLOB widths and the spatial types — but the list will always trail the server, so the fallback is gone too. A name this build has never heard of is kept as it is: it is still the truth about the column. BIT and YEAR join the types that carry a width, since a bare BIT means BIT(1). Worth noting the issue lists JSON, YEAR and BOOLEAN as missing. All three were already there. BIT, SERIAL, BOOL, the spatial types and the BLOB widths were the real gaps. ## AUTO_INCREMENT offered on every column (#383) MySQL answers `VARCHAR(255) AUTO_INCREMENT` with ERROR 1063. The checkbox was enabled regardless of type, so the first sign was the save failing. It is disabled now, with a tooltip saying why, and the generator refuses the flag as well — a disabled control is a convention, not a lock, and a column that carried the flag before its type changed would otherwise keep it. ## Two primary keys, or two indexes of one name (#384) Both were buildable, and both fail at the server: ERROR 1068 and ERROR 1061. The Indexes tab now marks the offending row and says which rule it breaks, including an index naming a column that no longer exists. It reports rather than silently repairing, since the issue's suggestion — replace the earlier primary key with the new one — decides something the user did not ask for. ## Tests Six on the generator, six on the component. Seven fail against the previous version; the rest guard behaviour that had to keep working — a well-formed index stays unmarked, integer columns still take AUTO_INCREMENT. Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #382, #383, #384 — three ways the designer let an invalid or lossy statement be assembled, each surfacing only when the save failed, or in the first case not surfacing at all.
Unknown types became VARCHAR — #382
A type the dropdown didn't list was replaced with VARCHAR on load. Editing anything about such a column then rewrote it. Confirmed against MySQL 8:
Silent, and the value's meaning changes. A JSON column fared better only by accident — it has no length, so the emitted
VARCHARwith no width is a syntax error and the save fails loudly instead.The list is longer now (BIT, BOOL, SERIAL, the BLOB widths, the spatial types) but a fixed list will always trail the server, so the fallback is gone too. A name this build has never heard of is kept as-is — it's still the truth about the column. BIT and YEAR join the types that carry a width, since a bare
BITmeansBIT(1).One correction: the issue lists JSON, YEAR and BOOLEAN as missing. All three were already there. BIT, SERIAL, BOOL, the spatial types and the BLOB widths were the real gaps.
AUTO_INCREMENT offered on every column — #383
MySQL answers
VARCHAR(255) AUTO_INCREMENTwithERROR 1063. The checkbox was enabled regardless of type, so the first sign was the save failing. It's disabled now with a tooltip saying why — and the generator refuses the flag as well, since a disabled control is a convention rather than a lock, and a column that carried the flag before its type was changed would otherwise keep it.Two primary keys, or two indexes of one name — #384
Both were buildable, and both fail at the server (
ERROR 1068,ERROR 1061). The Indexes tab marks the offending row and says which rule it breaks, including an index naming a column that no longer exists.It reports rather than silently repairing. The issue suggests replacing the earlier primary key with the new one; that decides something the user didn't ask for, and deleting an index row on their behalf is a worse surprise than being told what's wrong.
Tests
Six on the generator, six on the component. Seven fail against the previous version; the rest guard behaviour that had to keep working — a well-formed index stays unmarked, integer columns still take AUTO_INCREMENT.
1766 unit + 298 browser green, tsc/dprint/eslint clean.
🤖 Generated with Claude Code