1
- import { MigrationInterface , QueryRunner } from "typeorm" ;
2
- import { columnExists } from "@gitpod/gitpod-db/lib/typeorm/migration/helper/helper" ;
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
+ */
3
6
4
- export class WorkspaceInstanceUsageAddExtraFields1658144661198 implements MigrationInterface {
7
+ import { MigrationInterface , QueryRunner } from "typeorm" ;
8
+ import { columnExists } from "./helper/helper" ;
5
9
10
+ export class WorkspaceInstanceUsageAddExtraFields1658211404679 implements MigrationInterface {
6
11
public async up ( queryRunner : QueryRunner ) : Promise < void > {
7
-
8
- const columns = [ 'userId' , 'workspaceId' , 'projectId' , 'workspaceType' , 'workspaceClass' ] ;
12
+ const columns = [ "userId" , "workspaceId" , "projectId" , "workspaceType" , "workspaceClass" ] ;
9
13
10
14
const statements = columns
11
- . filter ( async col => {
12
- const exists = await columnExists ( queryRunner , "d_b_workspace_instance_usage" , col )
15
+ . filter ( async ( col ) => {
16
+ const exists = await columnExists ( queryRunner , "d_b_workspace_instance_usage" , col ) ;
13
17
return ! exists ;
14
18
} )
15
- . map ( col => {
19
+ . map ( ( col ) => {
16
20
return `ADD COLUMN ${ col } varchar(255) NOT NULL DEFAULT ''` ;
17
21
} ) ;
18
22
@@ -22,5 +26,4 @@ export class WorkspaceInstanceUsageAddExtraFields1658144661198 implements Migrat
22
26
}
23
27
24
28
public async down ( queryRunner : QueryRunner ) : Promise < void > { }
25
-
26
29
}
0 commit comments