From b05a4f888c0f9860dec361254f530bd067e3b1ce Mon Sep 17 00:00:00 2001 From: Andrew Farries Date: Mon, 24 Oct 2022 11:34:09 +0000 Subject: [PATCH] Add migration to change primary key --- ...666611052662-ChangeWorkspaceClusterTablePK.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 components/gitpod-db/src/typeorm/migration/1666611052662-ChangeWorkspaceClusterTablePK.ts diff --git a/components/gitpod-db/src/typeorm/migration/1666611052662-ChangeWorkspaceClusterTablePK.ts b/components/gitpod-db/src/typeorm/migration/1666611052662-ChangeWorkspaceClusterTablePK.ts new file mode 100644 index 00000000000000..800a3f40aca471 --- /dev/null +++ b/components/gitpod-db/src/typeorm/migration/1666611052662-ChangeWorkspaceClusterTablePK.ts @@ -0,0 +1,16 @@ +/** + * Copyright (c) 2022 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"; + +export class ChangeWorkspaceClusterTablePK1666611052662 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE d_b_workspace_cluster DROP PRIMARY KEY`); + await queryRunner.query(`ALTER TABLE d_b_workspace_cluster ADD PRIMARY KEY (name, applicationCluster)`); + } + + public async down(queryRunner: QueryRunner): Promise {} +}