Skip to content

feat(sql-editor): data migrate from side-by-side compare (≤500 ops) - #188

Merged
huyplb merged 4 commits into
mainfrom
cursor/query-data-compare-7e48
Aug 7, 2026
Merged

feat(sql-editor): data migrate from side-by-side compare (≤500 ops)#188
huyplb merged 4 commits into
mainfrom
cursor/query-data-compare-7e48

Conversation

@huyplb

@huyplb huyplb commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the merged compare work (#187). Adds Data migrate under Side-by-side Compare:

  • Compare data is off by default — turn it on to highlight diffs and reveal migrate
  • Key-column row matching (defaults to PK / unique)
  • Add / Edit / Delete — user opts in (none selected until checked)
  • Safety: Transaction + Stop / Continue on error; failed keys listed; progress shows ✓/✗/–
  • Include identity / IDs — preserve source autoincrement values on Add (off = destination generates)
  • Progress panel while applying each op
  • Pre-apply destination snapshot + data_migrate_runs history (API under /data-migrations + POST /data-migrate/execute)
  • >500 ops → toast with Server Beam chunked-copy instructions (no apply)
  • Skip trigger cols (default on) — ignore createdAt / updatedBy / similar in Compare highlights and migrate Edit detection; omit them from INSERT/UPDATE so destination triggers fill them

Cell colors from Compare remain for visual scanning; migrate uses key-based classification.

Side-by-side Compare data with Add/Edit/Delete migrate bar

How to use

  1. Check 2+ Destinations → Side-by-side → Run SELECT … ORDER BY …
  2. Turn on Compare data; pick source (baseline); leave Skip trigger cols on unless you need audit fields
  3. Under Data migrate, check Add / Edit / Delete as needed; keep Transaction / error mode for safety → Migrate N ops
  4. Over 500 ops: follow the toast → Server Beam sample

Test plan

  • Unit: classifyRowsByKey, buildDataMigratePlans, triggerManagedColumns, ignore-column compare
  • Unit: data-migrate execute (tx / stop / continue)
  • E2E: Compare off by default; turn on → migrate bar; Add/Edit/Delete unchecked (screenshot above)
  • Manual: apply edit + confirm history snapshot; confirm trigger cols do not force false updates

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Key-based insert/update/delete with checkboxes, optional identity IDs,
progress panel, destination snapshot, and data_migrate_runs history.
Over 500 ops toasts Server Beam instructions instead of applying.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/query-data-compare-7e48 branch from 04eafe1 to 1b80a17 Compare August 6, 2026 23:43
cursoragent and others added 2 commits August 6, 2026 23:55
Apply ops on a dedicated connection with optional all-or-nothing transaction
or continue-on-error (per-op tx). Progress and a failures list show each
failed key and error; skipped ops are marked after Stop.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
createdAt, updatedBy, and similar columns differ across databases even when
business rows match. Detect them by name heuristic, ignore in Compare
highlights and UPDATE detection by default, and omit them from migrate
INSERT/UPDATE so destination triggers can populate values.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
} = opts;

const ignoreLower = new Set(ignoreColumns.map((c) => c.toLowerCase()));
const sourceKeys = keyColumnsForGrid(keyNames, sourceColumns);
Side-by-side stays plain until Compare data is turned on. Migrate ops
(Add/Edit/Delete) start unchecked so the user chooses what to apply;
Transaction and Stop/Continue remain safety assists.

Co-authored-by: huy.phan9 <huyplb@users.noreply.github.com>
@huyplb
huyplb marked this pull request as ready for review August 7, 2026 00:30
@huyplb
huyplb merged commit 8a1bd55 into main Aug 7, 2026
6 of 7 checks passed
@cursor

cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_3bd1be44-abb7-4006-84b0-69a92eeb0148)

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.

2 participants