Skip to content

Commit 43e1789

Browse files
authored
chore: remove new added application and role table indexes (#8017)
1 parent 5a1e466 commit 43e1789

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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;

packages/schemas/tables/applications.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ create table applications (
2323
create 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-
2926
create index applications__is_third_party
3027
on applications (tenant_id, is_third_party);
3128

packages/schemas/tables/roles.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ create table roles (
1919
create 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-
2522
create index roles__type
2623
on roles (tenant_id, type);
2724

0 commit comments

Comments
 (0)