> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-feat-ai-sql-walkthroughs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Change Tracking

> Queue cell edits, row inserts, and deletions locally, review the SQL, then save

# Change Tracking

Changes are queued in memory, not applied immediately. Edit cells, insert rows, delete rows, then review everything before saving. Nothing touches the database until you click **Save Changes**. The queue is per-tab; switching tabs preserves your edits.

<Frame caption="Data grid with pending changes highlighted">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/change-tracking.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=07e9c4eca6e692c407249c6c3ddbd2d1" alt="Pending edits, inserts, and deletions highlighted in the data grid" width="1560" height="960" data-path="images/change-tracking.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/change-tracking-dark.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=904e561ebe469140fee976b147ad8b93" alt="Pending edits, inserts, and deletions highlighted in the data grid" width="1560" height="960" data-path="images/change-tracking-dark.png" />
</Frame>

## Data Changes

**Edit cells**: double-click a cell to edit (see [Data Grid](/features/data-grid)). Changes queue immediately. Changing a value back to its original removes it from the queue. Columns the driver marks immutable, such as MongoDB's `_id`, cannot be edited.

**Add rows**: click **+ Add** in the status bar or press `Cmd+Shift+N`. A new row appears at the bottom of the grid; columns with default values are pre-filled with `DEFAULT`. Edits to cells in a new row fold into the INSERT, not tracked as separate updates.

**Delete rows**: select rows and press `Delete`. Deleted rows show a strikethrough and stay visible until you save. Saving asks you to confirm before the rows are permanently deleted.

<Note>
  Deleting many rows saves as one batched DELETE with OR-combined conditions, not one query per row. Very large selections are split into a few statements to stay within the engine's bind-parameter limit.
</Note>

## Saving

Click **Save Changes** (the toolbar checkmark) or press `Cmd+S`. TablePro generates parameterized SQL, executes it, clears the queue, and refreshes the grid.

| Change        | Generated SQL                               |
| ------------- | ------------------------------------------- |
| Cell edit     | `UPDATE ... SET column = ? WHERE pk = ?`    |
| Row insertion | `INSERT INTO ... (columns) VALUES (?, ...)` |
| Row deletion  | `DELETE FROM ... WHERE pk = ? OR pk = ?`    |

Tables without a primary key are updated and deleted by matching every original column value; NULL values match with `IS NULL`. Saving fails with an error only when a row cannot be identified.

There is no discard button. To drop pending changes, undo them, or accept the **Discard Unsaved Changes?** prompt that appears when you refresh, sort, filter, change pages, or close the tab with edits pending.

## Previewing SQL

Click the eye icon in the toolbar or press `Cmd+Shift+P` to see the exact SQL before saving. The preview inlines parameter values so you can verify what will run, and **Copy All** copies every statement.

## Undo & Redo

| Action | Shortcut      |
| ------ | ------------- |
| Undo   | `Cmd+Z`       |
| Redo   | `Cmd+Shift+Z` |

`Cmd+Z` is context-aware: it undoes text edits when the SQL editor is focused and data changes when the grid is focused. Deleting multiple rows is a single undo action; undoing restores them all at once. Stacks are per-tab, and saving clears them.

## Schema Changes

Structure edits (columns, indexes, foreign keys, primary key) use the same queue: changes are tracked locally with visual indicators, previewable as DDL, and applied with **Save Changes**. See [Table Structure](/features/table-structure).
