Skip to content

Commit

Permalink
[db] Add index 'ind_dbsync' on d_b_code_sync_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
geropl authored and roboquat committed Oct 4, 2021
1 parent 3470fff commit fcff8ee
Showing 1 changed file with 25 additions and 0 deletions.
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}`);
}

}

0 comments on commit fcff8ee

Please sign in to comment.