Skip to content

Commit 185b980

Browse files
committed
[db] DBProject: drop deleted column (unused)
1 parent abe367b commit 185b980

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

components/gitpod-db/src/tables.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ export class GitpodTableDescriptionProvider implements TableDescriptionProvider
9494
deletionColumn: "deleted",
9595
timeColumn: "_lastModified",
9696
},
97-
{
98-
name: "d_b_project",
99-
primaryKeys: ["id"],
100-
deletionColumn: "deleted",
101-
timeColumn: "_lastModified",
102-
},
10397
{
10498
name: "d_b_project_env_var",
10599
primaryKeys: ["id", "projectId"],

components/gitpod-db/src/typeorm/entity/db-project.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
import { Entity, Column, PrimaryColumn, Index } from "typeorm";
88
import { TypeORM } from "../typeorm";
9-
import { ProjectSettings } from "@gitpod/gitpod-protocol";
9+
import { Project, ProjectSettings } from "@gitpod/gitpod-protocol";
1010
import { Transformer } from "../transformer";
1111

1212
@Entity()
1313
// on DB but not Typeorm: @Index("ind_lastModified", ["_lastModified"]) // DBSync
14-
export class DBProject {
14+
export class DBProject implements Project {
1515
@PrimaryColumn(TypeORM.UUID_COLUMN_TYPE)
1616
id: string;
1717

@@ -38,10 +38,6 @@ export class DBProject {
3838
@Column("varchar")
3939
creationTime: string;
4040

41-
// This column triggers the periodic deleter deletion mechanism. It's not intended for public consumption.
42-
@Column()
43-
deleted: boolean;
44-
4541
@Column()
4642
markedDeleted: boolean;
4743
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (c) 2023 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_project";
11+
const COLUMN_NAME = "deleted";
12+
13+
export class ProjectDropDeleted1695817445588 implements MigrationInterface {
14+
public async up(queryRunner: QueryRunner): Promise<void> {
15+
if (await columnExists(queryRunner, TABLE_NAME, COLUMN_NAME)) {
16+
await queryRunner.query(`ALTER TABLE \`${TABLE_NAME}\` DROP COLUMN \`${COLUMN_NAME}\`, ALGORITHM=INSTANT`);
17+
}
18+
}
19+
20+
public async down(queryRunner: QueryRunner): Promise<void> {
21+
if (!(await columnExists(queryRunner, TABLE_NAME, COLUMN_NAME))) {
22+
await queryRunner.query(
23+
`ALTER TABLE \`${TABLE_NAME}\` ADD COLUMN \`${COLUMN_NAME}\` tinyint(4) NOT NULL DEFAULT '0', ALGORITHM=INSTANT`,
24+
);
25+
}
26+
}
27+
}

components/gitpod-protocol/src/teams-projects-protocol.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ export interface Project {
4747
appInstallationId: string;
4848
settings?: ProjectSettings;
4949
creationTime: string;
50-
/** This is a flag that triggers the HARD DELETION of this entity */
51-
deleted?: boolean;
5250
markedDeleted?: boolean;
5351
}
5452

0 commit comments

Comments
 (0)