feat(migrate): index changes are opt-in, excluded from deploy by default#70
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-indexesflag onfox compare --ddlandfox migrate, defaultfalse, same semantics as the web checkbox (a sharedfilterIndexDiffs()helper backs both call sites).Test plan
npx vitest runfrom repo root — 260 passed, 2 skipped (was 254; +6 new: 4filterIndexDiffsunit tests, 1compare.test.tsintegration test, 1migrate.test.tsintegration test — all confirming the generator receives filteredindexDiffsby default and the full set with the opt-in)cd apps/web && npx tsc --noEmit— cleancd apps/cli && npx tsc --noEmit -p tsconfig.json— cleanidx_email), ran a compare, selected the table for deploy —CREATE INDEX IDX_EMAIL ON main.t1 (email);🤖 Generated with Claude Code