-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[db] Add index 'ind_dbsync' on d_b_code_sync_resource
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
components/gitpod-db/src/typeorm/migration/1633334251143-IndexCodeSyncCreated.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import {MigrationInterface, QueryRunner} from "typeorm"; | ||
import { indexExists } from "./helper/helper"; | ||
|
||
const INDEX_NAME = "ind_dbsync"; | ||
const TABLE_NAME = "d_b_code_sync_resource"; | ||
|
||
export class IndexCodeSyncCreated1633334251143 implements MigrationInterface { | ||
|
||
public async up(queryRunner: QueryRunner): Promise<any> { | ||
if (!(await indexExists(queryRunner, TABLE_NAME, INDEX_NAME))) { | ||
await queryRunner.query(`CREATE INDEX ${INDEX_NAME} ON ${TABLE_NAME} (created)`); | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<any> { | ||
await queryRunner.query(`DROP INDEX ${INDEX_NAME} ON ${TABLE_NAME}`); | ||
} | ||
|
||
} |