register migration from #7299 (#7429)

This commit is contained in:
Jonathan Brennan 2025-12-15 13:04:49 -06:00 committed by GitHub
parent a71cd2bbb9
commit bba35b5096
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 12 deletions

View file

@ -2,16 +2,26 @@ import { type MigrationExecutor } from '../pg-migrator';
export default {
name: '2025.11.25T00-00-00.members-search.ts',
run: ({ sql }) => sql`
-- The order was wrong. This was sorting by org_id, user_id, then created_at...
DROP INDEX IF EXISTS "organization_member_pagination_idx";
-- Replace "organization_member_pagination_idx" with a new index in the correct order
CREATE INDEX CONCURRENTLY IF NOT EXISTS "organization_member_pagination"
ON "organization_member" (
"organization_id" DESC
, "created_at" DESC
, "user_id" DESC
);
`,
noTransaction: true,
run: ({ sql }) => [
{
name: 'Drop old "organization_member_pagination_idx" index',
query: sql`
-- The order was wrong. This was sorting by org_id, user_id, then created_at...
DROP INDEX IF EXISTS "organization_member_pagination_idx";
`,
},
{
name: 'Create new "organization_member_pagination" index with correct order',
query: sql`
-- Replace "organization_member_pagination_idx" with a new index in the correct order
CREATE INDEX CONCURRENTLY IF NOT EXISTS "organization_member_pagination"
ON "organization_member" (
"organization_id" DESC
, "created_at" DESC
, "user_id" DESC
);
`,
},
],
} satisfies MigrationExecutor;

View file

@ -170,5 +170,6 @@ export const runPGMigrations = async (args: { slonik: DatabasePool; runTo?: stri
await import('./actions/2025.10.16T00-00-00.schema-log-by-commit-ordered'),
await import('./actions/2025.10.17T00-00-00.project-access-tokens'),
await import('./actions/2025.11.12T00-00-00.granular-oidc-role-permissions'),
await import('./actions/2025.11.25T00-00-00.members-search'),
],
});