File tree Expand file tree Collapse file tree 3 files changed +38
-6
lines changed
Expand file tree Collapse file tree 3 files changed +38
-6
lines changed Original file line number Diff line number Diff line change 1+ import { sql } from '@silverhand/slonik' ;
2+
3+ import type { AlterationScript } from '../lib/types/alteration.js' ;
4+
5+ const alteration : AlterationScript = {
6+ up : async ( pool ) => {
7+ await pool . query ( sql `
8+ drop index if exists applications__include_type_is_third_party;
9+ ` ) ;
10+
11+ await pool . query ( sql `
12+ drop index if exists roles__include_type_name;
13+ ` ) ;
14+ } ,
15+ down : async ( pool ) => {
16+ await pool . query ( sql `
17+ create index applications__include_type_is_third_party
18+ on applications (tenant_id) include (type, is_third_party);
19+ ` ) ;
20+
21+ // Update table statistics to help query planner use the new index efficiently
22+ await pool . query ( sql `
23+ analyze applications;
24+ ` ) ;
25+
26+ await pool . query ( sql `
27+ create index roles__include_type_name
28+ on roles (tenant_id) include (type, name);
29+ ` ) ;
30+
31+ // Update table statistics to help query planner use the new index efficiently
32+ await pool . query ( sql `
33+ analyze roles;
34+ ` ) ;
35+ } ,
36+ } ;
37+
38+ export default alteration ;
Original file line number Diff line number Diff line change @@ -23,9 +23,6 @@ create table applications (
2323create index applications__id
2424 on applications (tenant_id, id);
2525
26- create index applications__include_type_is_third_party
27- on applications (tenant_id) include (type, is_third_party);
28-
2926create index applications__is_third_party
3027 on applications (tenant_id, is_third_party);
3128
Original file line number Diff line number Diff line change @@ -19,9 +19,6 @@ create table roles (
1919create index roles__id
2020 on roles (tenant_id, id);
2121
22- create index roles__include_type_name
23- on roles (tenant_id) include (type, name);
24-
2522create index roles__type
2623 on roles (tenant_id, type);
2724
You can’t perform that action at this time.
0 commit comments