Skip to content
Tinker
Download

Structure designer and sync

Editing structure, not rows, under the same discipline: nothing runs until you have read the SQL, and what runs, runs in one transaction.

The Structure tab is read-only until you press Edit, so browsing a production schema cannot alter it by a stray keystroke.

Panes

  • Columns — name, type, length, precision and scale, nullable, default, identity or auto-increment, generated expression, character set, collation, comment. Enum members are edited in their own sheet. Reordering is offered only on MySQL, which supports AFTER; on PostgreSQL the control is absent, not disabled with a tooltip.
  • Indexes — name, method (btree, hash, gin, gist, brin, spgist on PostgreSQL; btree, hash, fulltext, spatial on MySQL), columns with per-column direction, unique, partial predicate, comment.
  • Primary key — chosen on the Columns pane by marking columns in key order. Dropping and adding a primary key is one edit, not two.
  • Foreign keys — local columns, referenced table and columns, ON UPDATE and ON DELETE, deferrability on PostgreSQL.
  • Checks, Triggers, Partitions and Table (name, comment, engine and charset on MySQL, tablespace on PostgreSQL).

How a change is applied

The designer never mutates anything as you type. It holds an edited definition beside the one introspection returned. Preview diffs the two and renders the statements in execution order, syntax-highlighted; it is the only route to Execute. Everything runs in one transaction. Afterwards the table’s introspection is invalidated and the pane reloads from the server, so what you see is what the server has, never what was requested.

Careful
MySQL commits DDL implicitly. On MySQL the preview says so plainly, lists the statements that will not roll back, and asks for confirmation naming the table. If a statement fails, the sheet reports exactly which statements had already committed.

SQLite rebuilds a table rather than pretending to alter it

SQLite's ALTER TABLE cannot express every column change. Where it cannot, the change is applied the way SQLite's own documentation prescribes: the table is rebuilt inside one transaction, with the data copied across and the indexes, triggers and foreign keys recreated. The preview shows those statements in the order they will run, the same as anywhere else, so what you approve is what executes.

Create table

⌘⇧N opens the same editor with an empty definition. It emits one CREATE TABLE plus the CREATE INDEX, COMMENT ON and trigger statements the definition needs, in dependency order.

Structure sync

Structure sync compares a source table or schema against a target on any configured connection, including across engines, and produces the DDL that would make the target match. Across engines it compares the two definitions only after translating each into the target’s terms, and sets aside the facets one engine has and the other does not, so a table freshly copied across reads as identical rather than as a page of differences. It is a generator, not an applier: the result opens in a SQL editor tab. Destructive statements are listed separately in the preview and are unchecked by default. Syncing a table against itself produces no statements.