Repository navigation
feat(utilities): Change Column — rename or change a type the safe way, as steps to review - #589
Conversation
…, as steps to review Step 2 of docs/plans/2026-11-01-safe-column-change.md (board card safe-column-change): the screen over planColumnChange (#588). Utilities → Change Column, for the credential picked in the header: pick a table and column, give a new name, a new type (the schema's types are offered), or both, and a batch size. It shows what the change touches (indexes, foreign keys, views and triggers that may use it), any warning (lossy conversion, no triggers on this engine), or why the change is refused. The steps are numbered, each with its SQL, a rerun-safe badge, a note and Copy; Copy all and Open in editor take the whole script. Open in editor opens a new tab named for the change, with this connection as the only destination: the steps belong to one database, never to whatever else is checked. Nothing runs from the screen. planColumnChange reaches the browser through @foxschema/ui-shared and the shared/lib/column-change facade. utilities.columns joins the feature map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test IDsAdded (19)
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 90a5feb. Configure here.
| void navigator.clipboard?.writeText(text).then(() => { | ||
| setDone(true); | ||
| setTimeout(() => setDone(false), 1500); | ||
| }); |
There was a problem hiding this comment.
Copy throws without clipboard API
Medium Severity
CopyButton calls .then() on navigator.clipboard?.writeText(...). When clipboard is missing that expression is undefined and the click throws, so Copy all and per-step Copy do nothing. A rejected writeText is also left unhandled. Sibling utilities already go through writeClipboard, which covers both cases and only reports success after a real write.
Reviewed by Cursor Bugbot for commit 90a5feb. Configure here.
| setLoadError(null); | ||
| try { | ||
| ensureConnectionSelected(lockedConnectionId); | ||
| await ensureSchema(lockedConnectionId); |
There was a problem hiding this comment.
Panel adds editor run destination
Medium Severity
load always calls ensureConnectionSelected, which is add-only: it checks the Utilities credential on the active SQL Editor tab. Opening Change Column can therefore attach that database to some other query. ensureSchema already loads by connection id and does not need the destination ticked. A later Run on the original tab can then hit this extra database.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 90a5feb. Configure here.
| editor.setSql(script); | ||
| editor.renameTab(useSqlEditorStore.getState().activeTabId, `Change ${table?.name}.${column?.name}`); | ||
| editor.selectOnlyConnection(lockedConnectionId); | ||
| setActiveView('sqlEditor'); |
There was a problem hiding this comment.
Editor open retargets every shared tab
Medium Severity
Open in editor creates a tab and then calls selectOnlyConnection. When destination sharing is on, that writes the shared list, so every tab switches to this one connection. Unrelated queries that were aimed at another database are silently retargeted, and a later Run can execute against the wrong server.
Reviewed by Cursor Bugbot for commit 90a5feb. Configure here.


Step 2 of the safe column change design, for the board card
safe-column-change: the screen overplanColumnChange(#588, merged).What it does
Utilities → Change Column (Maintenance group) works on the credential picked in the Utilities header:
-- Step n: …comment.Nothing runs from the screen.
planColumnChangereaches the browser through@foxschema/ui-sharedand ashared/lib/column-change.tsfacade, as the import rules require.utilities.columnsjoins the feature map (FEATURE_MAP.md,data.js, rebuilt page: 35 features).Tests
ColumnChangePanel.test.tsx, run against the real editor store with a cached schema:All 86 Utilities tests pass, and so do the feature-map drift test, the test-ID catalog (regenerated),
ui-sharedand the frontend architecture test.tscand eslint are clean.Live: on the seeded Postgres
demo_a, pickingorders.statuswith typevarchar(30)showedidx_a_orders_statusunder impact and the seven steps with this schema's SQL. Open in editor gave a Change orders.status tab starting at Step 1, with only that connection checked.🤖 Generated with Claude Code
Note
Medium Risk
The feature produces multi-step DDL/DML migration scripts for column renames and type changes; execution stays manual in the editor, but mistaken runs could still affect production data.
Overview
Adds Utilities → Change Column as a new Maintenance tool wired to the locked connection in the Utilities header. Users pick table/column, optional new name and/or type, and batch size; the UI calls
planColumnChange(via@foxschema/ui-sharedand a thinshared/lib/column-changere-export) to show impact (indexes, FKs, views/triggers), warnings, refusals, and numbered steps with per-step and full-script copy.Open in editor creates a new SQL tab titled for the change, loads the commented multi-step script, restricts execution to only that connection, and switches to the SQL editor—nothing executes from the panel itself. Session password unlock and schema load mirror other utilities.
Also adds
ColumnChangePanel.test.tsx, e2ecolumn-change-*/utilities-change-columntest IDs, and registersutilities.columnsin the feature map (35 features).Reviewed by Cursor Bugbot for commit 90a5feb. Bugbot is set up for automated code reviews on this repo. Configure here.