Skip to content

Commit 606cc4d

Browse files
committed
[db] Add index to d_b_personal_access_token on createdAt
1 parent 28a7fda commit 606cc4d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
* Licensed under the GNU Affero General Public License (AGPL).
4+
* See License-AGPL.txt in the project root for license information.
5+
*/
6+
7+
import { MigrationInterface, QueryRunner } from "typeorm";
8+
import { columnExists } from "./helper/helper";
9+
10+
const table = "d_b_personal_access_token";
11+
const col = "createdAt";
12+
const indexName = "idx_createdAt";
13+
14+
export class PersonalAccessTokenIndexCreationTime1669104291275 implements MigrationInterface {
15+
public async up(queryRunner: QueryRunner): Promise<void> {
16+
if (!(await columnExists(queryRunner, table, col))) {
17+
await queryRunner.query(
18+
`CREATE INDEX \`${indexName}\` ON \`${table}\` (${col}), ALGORITHM=INPLACE, LOCK=NONE`,
19+
);
20+
}
21+
}
22+
public async down(queryRunner: QueryRunner): Promise<void> {}
23+
}

0 commit comments

Comments
 (0)