Skip to content

fix(designer): stop the form building DDL the server will not take - #550

Merged
EVWorth merged 1 commit into
mainfrom
fix/designer-invalid-ddl
Sep 5, 2026
Merged

EVWorth merged 1 commit into
mainfrom
fix/designer-invalid-ddl

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 5, 2026

Copy link
Copy Markdown
Owner

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:

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 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 BIT means BIT(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_INCREMENT with ERROR 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

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]>
@EVWorth
EVWorth merged commit 9eef999 into main Sep 5, 2026
10 checks passed
@EVWorth
EVWorth deleted the fix/designer-invalid-ddl branch September 5, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1][bug] COLUMN_TYPES is incomplete — BIT, JSON, YEAR, BOOL, SERIAL, GEOMETRY fall back to VARCHAR on round-trip

1 participant