diff --git a/components/gitpod-db/src/typeorm/migration/1663751455102-PrebuildWorkspaceDBSync.ts b/components/gitpod-db/src/typeorm/migration/1663751455102-PrebuildWorkspaceDBSync.ts new file mode 100644 index 00000000000000..f70bca64250d88 --- /dev/null +++ b/components/gitpod-db/src/typeorm/migration/1663751455102-PrebuildWorkspaceDBSync.ts @@ -0,0 +1,23 @@ +/** + * 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"; +import { columnExists } from "./helper/helper"; + +const TABLE_NAME = "d_b_prebuilt_workspace"; +const COLUMN_NAME = "deleted"; + +export class PrebuildWorkspaceDBSync1663751455102 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + if (!(await columnExists(queryRunner, TABLE_NAME, COLUMN_NAME))) { + await queryRunner.query( + `ALTER TABLE ${TABLE_NAME} ADD COLUMN \`${COLUMN_NAME}\` tinyint(4) NOT NULL DEFAULT '0', ALGORITHM=INPLACE, LOCK=NONE`, + ); + } + } + + public async down(queryRunner: QueryRunner): Promise {} +}