Skip to content

Commit 439b1b6

Browse files
committed
[gitpod-db] Drop deprecated 'attributedTeamId' column from workspace instances
1 parent d5a0667 commit 439b1b6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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_NAME = "d_b_workspace_instance";
11+
const COLUMN_NAME = "attributedTeamId";
12+
13+
export class WorkspaceInstanceAttributedTeam1654847406624 implements MigrationInterface {
14+
public async up(queryRunner: QueryRunner): Promise<void> {
15+
if (await columnExists(queryRunner, TABLE_NAME, COLUMN_NAME)) {
16+
await queryRunner.query(
17+
`ALTER TABLE ${TABLE_NAME} DROP COLUMN ${COLUMN_NAME}, ALGORITHM=INPLACE, LOCK=NONE`,
18+
);
19+
}
20+
}
21+
22+
public async down(queryRunner: QueryRunner): Promise<void> {
23+
if (!(await columnExists(queryRunner, TABLE_NAME, COLUMN_NAME))) {
24+
await queryRunner.query(
25+
`ALTER TABLE ${TABLE_NAME} ADD COLUMN ${COLUMN_NAME} char(36) NOT NULL DEFAULT '', ALGORITHM=INPLACE, LOCK=NONE`,
26+
);
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)