fix(schema): remove three trigram index declarations that were already dropped#1409
Open
jakebromberg wants to merge 1 commit into
Open
fix(schema): remove three trigram index declarations that were already dropped#1409jakebromberg wants to merge 1 commit into
jakebromberg wants to merge 1 commit into
Conversation
…y dropped (#1129) `shared/database/src/schema.ts` declared three GIN trigram indexes (`auth_user_dj_name_trgm_idx`, `auth_user_name_trgm_idx`, `shows_legacy_dj_name_trgm_idx`) that migrations 0054 and 0065 explicitly dropped. Because drizzle-kit treats `schema.ts` as the source of truth, the cumulative snapshot kept carrying the entries forward — a fresh dev/test DB would recreate the dead-weight indexes, and a future `drizzle:generate` against an aligned dev DB would emit a noisy catch-up migration. - Remove the three `index(...)` declarations from `schema.ts`. - Add 0094 catch-up migration with `DROP INDEX IF EXISTS` for each (no-op against environments that already applied 0054/0065). - Update `meta/0094_snapshot.json` + journal + applied-hashes.json (drizzle-kit-generated; journal `when` bumped to previous + 1ms per the hand-edit-when rule). - Add `schema.dropped-trigram-indexes.test.ts` drift-prevention guard. Search reads from `flowsheet.dj_name` + `flowsheet_dj_name_trgm_idx`; no query path joins through `auth_user` or `shows` for dj-name trigram lookup. Closes #1129
Schema constraint shape reportdata-shape report errored (exit 0): node:internal/modules/runmain:107 triggerUncaughtException( ^ Error ERRMODULENOTFOUND: Cannot find package 'postgres' imported from /home/runner/work/Backend-Service/Backend-Service/scripts/schema-shape-report.mjs Did you mean to import "postgres/cjs/src/index.js"? at Object.getPackageJ; manual check required |
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
shared/database/src/schema.tsdeclared three GIN trigram indexes —auth_user_dj_name_trgm_idx,auth_user_name_trgm_idx, andshows_legacy_dj_name_trgm_idx— that migrations 0054 and 0065 explicitlyDROP INDEX-ed. Because drizzle-kit treatsschema.tsas the source of truth, every snapshot since 0055 kept carrying the entries forward — a fresh dev/test DB rebuilt from the schema would recreate the dead-weight indexes, and a futuredrizzle:generateagainst an aligned dev DB would emit a noisy catch-up migration.Search no longer joins through
auth_userorshowsfor dj-name lookup; reads come fromflowsheet.dj_name+flowsheet_dj_name_trgm_idx.Changes
index(...)declarations fromschema.ts(with breadcrumb comments explaining why).0094_drop-stale-trigram-indexes.sqlcatch-up migration withDROP INDEX IF EXISTSfor each (no-op against environments that already applied 0054/0065).meta/0094_snapshot.json+ journal + applied-hashes.json (drizzle-kit-generated; journalwhenbumped toprevious + 1msper the hand-edit-when rule).tests/unit/database/schema.dropped-trigram-indexes.test.tsdrift-prevention guard so a future edit can't reintroduce the declarations.Test plan
npm run lintnpm run format:checknpm run typechecknpm run test:unit(3155 tests pass)npm run lint:migrations(validator clean)Closes #1129