Skip to content

feat(migrate): index changes are opt-in, excluded from deploy by default#70

Merged
huyplb merged 1 commit into
mainfrom
feat/index-deploy-opt-in
Jul 13, 2026
Merged

feat(migrate): index changes are opt-in, excluded from deploy by default#70
huyplb merged 1 commit into
mainfrom
feat/index-deploy-opt-in

Conversation

@huyplb

@huyplb huyplb commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Per user request: index CREATE/DROP/ALTER changes should require an explicit "yes, migrate this" decision instead of shipping automatically whenever their table is selected for deploy. Default is now excluded (unchecked / off).

Web app — new checkbox in the Schema Diff tab's "Table Indexes" section, per index, unchecked by default, plus a "Deploy all indexes" master toggle in the section header. Mirrors the existing role-member opt-out pattern (memberSelection) but with the polarity reversed — an index change needs an explicit opt-in, not an opt-out.

CLI — new --include-indexes flag on fox compare --ddl and fox migrate, default false, same semantics as the web checkbox (a shared filterIndexDiffs() helper backs both call sites).

Test plan

  • npx vitest run from repo root — 260 passed, 2 skipped (was 254; +6 new: 4 filterIndexDiffs unit tests, 1 compare.test.ts integration test, 1 migrate.test.ts integration test — all confirming the generator receives filtered indexDiffs by default and the full set with the opt-in)
  • cd apps/web && npx tsc --noEmit — clean
  • cd apps/cli && npx tsc --noEmit -p tsconfig.json — clean
  • Manually verified live in the browser: connected two SQLite databases differing only by one index (idx_email), ran a compare, selected the table for deploy —
    • Index checkbox unchecked (default) → Migration SQL tab shows "No schema changes detected. Target database is in sync with source."
    • Checked the per-index box → SQL regenerates live to CREATE INDEX IDX_EMAIL ON main.t1 (email);

🤖 Generated with Claude Code

Index CREATE/DROP/ALTER changes are no longer auto-included just because
their table is selected for deploy — they now require an explicit,
per-index opt-in, and default to excluded.

Web app (Schema Diff tab, Table Indexes section):
- New per-index checkbox ("Include this index change in the deploy
  script"), unchecked by default, plus a "Deploy all indexes" master
  toggle in the section header — mirrors the existing role-member
  opt-out pattern (memberSelection) but with reversed polarity (opt-IN
  instead of opt-OUT), since the whole point is index changes shouldn't
  ship silently.
- New indexSelection store state + toggleIndexSelection/
  setAllIndexSelection actions; buildIncludedDiffs/regenerateSql now
  filter each table's indexDiffs through it before SQL generation.

CLI (fox compare --ddl, fox migrate):
- New --include-indexes flag (default false) with the same semantics;
  shared filterIndexDiffs() helper in runtime/engine.ts.

Verified live in the browser against two SQLite files differing only by
one index: unchecked -> "No schema changes detected"; checking the
per-index box -> SQL regenerates to include CREATE INDEX. 260 unit tests
pass (+6 new); both apps/web and apps/cli typecheck clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@huyplb huyplb merged commit d8be56e into main Jul 13, 2026
4 of 6 checks passed
@huyplb huyplb deleted the feat/index-deploy-opt-in branch July 13, 2026 19:55
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.

1 participant