Skip to content

[P1][bug] AutoIncrement checkbox enabled on all column types — designer emits VARCHAR AUTO_INCREMENT, fails on save #383

Closed

Description

@EVWorth

Context

Table Designer column-level checkbox for auto_increment.

Problem

src/components/designer/TableDesigner.tsx:200-205 — the autoIncrement checkbox is enabled for every column regardless of type. buildColumnDef (ddl-generator.ts:55-58) appends AUTO_INCREMENT if the flag is set. MySQL rejects VARCHAR(255) AUTO_INCREMENT with ERROR 1063 (42000): Incorrect column specifier for column 'x'. AUTO_INCREMENT requires an integer type (INT, BIGINT, TINYINT, SMALLINT, MEDIUMINT) and an index/key on the column. The error surfaces at Save time only.

Files

  • src/components/designer/TableDesigner.tsx:200-205, 498-505
  • src/lib/ddl-generator.ts:55-58

Repro

  1. Create a VARCHAR column
  2. Tick the AUTO_INCREMENT checkbox
  3. Click Create Table — MySQL returns error 1063

Expected

VARCHAR column's AUTO_INCREMENT checkbox is disabled with a tooltip "Auto-increment requires an integer type and an index". An INT column's checkbox is enabled.

Proposed fix

Disable the autoIncrement checkbox unless TYPES_WITH_LENGTH.has(col.type) AND the type starts with INT|BIGINT|TINYINT|SMALLINT|MEDIUMINT. Show a tooltip explaining the restriction when disabled. Scope: S.

Acceptance

A VARCHAR column's AUTO_INCREMENT checkbox is disabled with the tooltip. An INT column's checkbox is enabled. Saving a VARCHAR with autoIncrement=true (forced via setState in test) returns the MySQL error message clearly.

Needs human verify

no

Doc drift

no

Activity

  1. added
    audit
    severity/p1
    kind/bug
    area/designer
    on Jul 31, 2026
  2. EVWorth commented on Sep 12, 2026

    @EVWorth
    OwnerAuthor

    Already fixed — closing with the check rather than a change.

    The AUTO_INCREMENT checkbox is disabled unless the column's type can carry one (canAutoIncrement), with a tooltip saying why, and buildColumnDef will not emit it for such a type even if the flag is set — so a config loaded from elsewhere cannot produce VARCHAR(255) AUTO_INCREMENT either. That is ERROR 1063, and it used to be visible only at save time. Test: "will not let a VARCHAR be marked auto-increment".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/designerauditkind/bugseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions