File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' hive ' : patch
3
+ ---
4
+
5
+ Remove redundant pg indices
Original file line number Diff line number Diff line change
1
+ import { type MigrationExecutor } from '../pg-migrator' ;
2
+
3
+ /**
4
+ * This migration removes indices that are covered by other btree indices.
5
+ * This should have no impact on performance while lowering our db footprint.
6
+ */
7
+ export default {
8
+ name : '2025.05.15T00-00-00.redundant-indices.ts' ,
9
+ noTransaction : true ,
10
+ run : ( { sql } ) => [
11
+ // redundant with schema_versions_cursor_pagination
12
+ {
13
+ name : 'drop index schema_versions_target_id' ,
14
+ query : sql `
15
+ DROP INDEX CONCURRENTLY IF EXISTS "schema_versions_target_id"
16
+ ` ,
17
+ } ,
18
+ // redundant with organization_member_pkey
19
+ {
20
+ name : 'drop index organization_member_organization_id' ,
21
+ query : sql `
22
+ DROP INDEX CONCURRENTLY IF EXISTS "organization_member_organization_id"
23
+ ` ,
24
+ } ,
25
+ // redundant with schema_checks_connection_pagination
26
+ {
27
+ name : 'drop index schema_checks_target_id' ,
28
+ query : sql `
29
+ DROP INDEX CONCURRENTLY IF EXISTS "schema_checks_target_id"
30
+ ` ,
31
+ } ,
32
+ // redundant with schema_version_to_log_pkey
33
+ {
34
+ name : 'drop index schema_version_to_log_version_id' ,
35
+ query : sql `
36
+ DROP INDEX CONCURRENTLY IF EXISTS "schema_version_to_log_version_id"
37
+ ` ,
38
+ } ,
39
+ ] ,
40
+ } satisfies MigrationExecutor ;
Original file line number Diff line number Diff line change @@ -163,5 +163,6 @@ export const runPGMigrations = async (args: { slonik: DatabasePool; runTo?: stri
163
163
await import ( './actions/2025.02.21T00-00-00.schema-versions-metadata-attributes' ) ,
164
164
await import ( './actions/2025.03.20T00-00-00.dangerous_breaking' ) ,
165
165
await import ( './actions/2025.05.14T00-00-00.cascade-deletion-indices-2' ) ,
166
+ await import ( './actions/2025.05.15T00-00-00.redundant-indices' ) ,
166
167
] ,
167
168
} ) ;
You can’t perform that action at this time.
0 commit comments