Skip to content

Commit 9ddf926

Browse files
committed
Add migration
1 parent cd5d325 commit 9ddf926

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Copyright (c) 2024 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 = "d_b_org_settings";
11+
const newColumn = "maxParallelRunningWorkspaces";
12+
13+
export class AddOrgSettingsMaxParallelWorkspaces1734079239772 implements MigrationInterface {
14+
public async up(queryRunner: QueryRunner): Promise<void> {
15+
if (!(await columnExists(queryRunner, table, newColumn))) {
16+
await queryRunner.query(`ALTER TABLE ${table} ADD COLUMN ${newColumn} INTEGER NOT NULL DEFAULT 0`);
17+
}
18+
}
19+
20+
public async down(queryRunner: QueryRunner): Promise<void> {
21+
if (await columnExists(queryRunner, table, newColumn)) {
22+
await queryRunner.query(`ALTER TABLE ${table} DROP COLUMN ${newColumn}`);
23+
}
24+
}
25+
}

gitpod-ws.code-workspace

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
{
2222
"path": "components/gitpod-cli"
2323
},
24+
{
25+
"path": "components/dashboard"
26+
},
2427
{
2528
"path": "components/gitpod-protocol"
2629
},

0 commit comments

Comments
 (0)