Skip to content

feat(migrations): Fail/Skip/Overwrite import options across migration wizard, CSV & JSON import - #2964

Merged
premtsd-code merged 8 commits into
mainfrom
csv-import-upsert
May 11, 2026
Merged

feat(migrations): Fail/Skip/Overwrite import options across migration wizard, CSV & JSON import#2964
premtsd-code merged 8 commits into
mainfrom
csv-import-upsert

Conversation

@premtsd-code

@premtsd-codepremtsd-code commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Reworks the duplicate-handling UI for all migration import flows around the OnDuplicate enum (Fail / Skip / Overwrite) shipped by the cloud worker + utopia-php/migration 1.x:

  • Migration wizard (Appwrite source) — replaces the prior two checkboxes with a three-option radio group, Fail on duplicate pre-selected so the default behavior is visible. Wording reflects that overwrite/skip apply to the entire resource tree (databases, tables, columns, indexes, rows), not just rows. The option block is only rendered when the Databases resource is selected, and the value is gated to Fail at submit time if Databases is later deselected (so unticking Databases never silently applies overwrite/skip to users/functions/etc.).
  • Tables (TablesDB) CSV import — same three-option radio replacing the prior checkboxes. Wording stays document-centric since CSV import is row-only.
  • Collections (DocumentsDB) JSON import — previously imported with no onDuplicate (silent default to fail). Now opens the same Import options dialog with the Fail/Skip/Overwrite radios.

Also:

  • Bumps @appwrite.io/console to the released 12.2.0 so the OnDuplicate enum + onDuplicate params on createAppwriteMigration / createCSVImport / createJSONImport are available.
  • Renames OnDuplicate.UpsertOnDuplicate.Overwrite throughout (the enum was renamed upstream; the prior reference compiled to undefined and silently defaulted the backend to Fail).
  • Picks up the upstream Proxy updateRuleStatus rename + Variables variableId compat fixes required by the bumped SDK.
  • Fixes the duplicate Layout / Typography import in table-[table]/+page.svelte that caused a Svelte parse error.

Test plan

  • Migration wizard: import options hidden when only Users / Functions / Storage selected
  • Migration wizard: import options visible (3 radios, Fail pre-selected) when Databases is checked
  • Migration wizard: deselecting Databases after picking Overwrite/Skip → request still sends onDuplicate: fail
  • CSV import dialog: Fail / Skip / Overwrite radios; selected value reaches createCSVImport
  • JSON import dialog: Fail / Skip / Overwrite radios; selected value reaches createJSONImport
  • bun check clean (0 errors)

After changes

Import CSV/JSON:
/home/premtsd/Videos/Screencasts/Screencast from 2026-05-11 11-20-24.webm

Migration:
/home/premtsd/Videos/Screencasts/Screencast from 2026-05-11 11-39-16.webm

Related

- Merge duplicate Layout/Typography import in table +page.svelte
- Only show overwrite/skip checkboxes in migration wizard when
Databases resource is selected
@greptile-apps

greptile-appsBot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a Svelte parse error caused by a duplicate @appwrite.io/pink-svelte import in table/+page.svelte, and gates the migration wizard's overwrite/skip import options so they only appear (and only take effect) when the Databases resource is selected. It also introduces a new pre-import dialog in both the collection and table pages that lets users choose how to handle duplicate document/row IDs before starting a JSON or CSV import.

  • Duplicate import fix (table/+page.svelte): consolidates two separate @appwrite.io/pink-svelte import statements into one, adding Dialog and Selector at the same time.
  • Wizard gate (wizard.svelte): importOnDuplicate radio buttons are now rendered only when $formData.databases.root is true, and onFinish resets the effective value to OnDuplicate.Fail when databases are not selected, preventing stale state from being submitted.
  • New import-options dialog (collection/+page.svelte, table/+page.svelte): onSelect now stores the pending file and opens a dialog; startImport reads the chosen OnDuplicate value and clears pendingFile in a finally block.

Confidence Score: 5/5

All three changes are self-contained and well-scoped; the stale-state gate in the wizard is correctly applied at submit time, and the new import-options dialogs clean up pending state in finally blocks.

The wizard fix correctly guards onDuplicate at submit time regardless of the local variable's last value, and the two new dialogs follow a straightforward pending-state pattern with proper cleanup. No logic paths leave state in an inconsistent or dangerous condition.

No files require special attention beyond the minor label terminology inconsistency in table/+page.svelte.

Important Files Changed

FilenameOverview
src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/+page.svelteAdds an import-options dialog (Fail/Skip/Overwrite) before JSON import; splits onSelect into onSelect+startImport with correct pending-state management and cleanup in finally.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelteFixes duplicate pink-svelte import (adding Dialog/Selector), mirrors the import-options dialog pattern from the collection page; minor label inconsistency ("Documents" vs "rows" terminology).
src/routes/(console)/project-[region]-[project]/settings/migrations/(import)/wizard.svelteGates onDuplicate radio buttons on databases.root selection and correctly resets the effective value to Fail at submit time regardless of local importOnDuplicate state; spreads importOptions into all four provider cases.

Reviews (5): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

premtsd-codeand others added 7 commits April 23, 2026 12:18
…csv-import-upsert
# Conflicts:
#	src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte
Reworks the import-options UI in three places to match the new
OnDuplicate enum (Fail / Skip / Overwrite) shipped by the cloud worker
and migration package:
- Settings → Migrations wizard (Appwrite source): three-option radio
group with Fail pre-selected. Wording reflects that overwrite/skip
apply to the entire resource tree (databases, tables, columns,
indexes, rows), not just rows.
- Tables (TablesDB) CSV import: same three-option radio replacing
the prior two checkboxes. Wording stays document-centric since CSV
import is row-only.
- Collections (DocumentsDB) JSON import: previously imported with no
onDuplicate (silent default to fail). Now opens the same Import
options dialog with Fail/Skip/Overwrite radios.
Also bumps @appwrite.io/console SDK to https://pkg.vc/-/@appwrite/
@appwrite.io/console@341620a so the OnDuplicate enum exports match
the merged backend (post 1.9.x).
Renamed OnDuplicate.Upsert -> OnDuplicate.Overwrite throughout the
console (the enum was renamed in upstream PR #11910 / migration 1.9.7;
the prior reference compiled to undefined and silently defaulted the
backend to Fail).
The Fail/Skip/Overwrite radios are only rendered when the Databases
resource is checked. The local importOnDuplicate value, however,
persists across toggles — so unticking Databases after picking
Overwrite or Skip would silently apply that mode to the entire
migration payload (users, teams, functions, etc.) on submit.
Gate the value at submit time: only forward importOnDuplicate when
$formData.databases.root is true; otherwise always send Fail.
Addresses greptile P1 review on PR #2964.
@premtsd-codepremtsd-code changed the title Fix duplicate import and gate overwrite/skip on database selectionfeat(migrations): Fail/Skip/Overwrite import options across migration wizard, CSV & JSON importMay 11, 2026
@premtsd-code
premtsd-code merged commit 28c3992 into mainMay 11, 2026
5 checks passed
@premtsd-code
premtsd-code deleted the csv-import-upsert branch May 11, 2026 10:59
Sign up for freeto 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.

3 participants

@premtsd-code@HarshMN2345@ArnabChatterjee20k