diff --git a/components/gitpod-db/src/typeorm/entity/db-team-settings.ts b/components/gitpod-db/src/typeorm/entity/db-team-settings.ts index d5e357219014a3..8ad2e5d8ee9e43 100644 --- a/components/gitpod-db/src/typeorm/entity/db-team-settings.ts +++ b/components/gitpod-db/src/typeorm/entity/db-team-settings.ts @@ -24,6 +24,9 @@ export class DBOrgSettings implements OrganizationSettings { @Column("json", { nullable: true }) allowedWorkspaceClasses?: string[] | null; + @Column("json", { nullable: true }) + pinnedEditorVersions?: { [key: string]: string } | null; + @Column() deleted: boolean; } diff --git a/components/gitpod-db/src/typeorm/migration/1709626232691-AddPinnedEditorVersions.ts b/components/gitpod-db/src/typeorm/migration/1709626232691-AddPinnedEditorVersions.ts new file mode 100644 index 00000000000000..be839dcd9ed3b7 --- /dev/null +++ b/components/gitpod-db/src/typeorm/migration/1709626232691-AddPinnedEditorVersions.ts @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2024 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 = "d_b_org_settings"; +const newColumn = "pinnedEditorVersions"; + +export class AddPinnedEditorVersions1709626232691 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + if (!(await columnExists(queryRunner, table, newColumn))) { + await queryRunner.query(`ALTER TABLE ${table} ADD COLUMN ${newColumn} JSON NULL`); + } + } + + public async down(queryRunner: QueryRunner): Promise { + if (await columnExists(queryRunner, table, newColumn)) { + await queryRunner.query(`ALTER TABLE ${table} DROP COLUMN ${newColumn}`); + } + } +} diff --git a/components/gitpod-db/src/typeorm/team-db-impl.ts b/components/gitpod-db/src/typeorm/team-db-impl.ts index ba4eb586e3c0a1..ec64c8d5cb10df 100644 --- a/components/gitpod-db/src/typeorm/team-db-impl.ts +++ b/components/gitpod-db/src/typeorm/team-db-impl.ts @@ -360,7 +360,13 @@ export class TeamDBImpl extends TransactionalDBImpl implements TeamDB { const repo = await this.getOrgSettingsRepo(); return repo.findOne({ where: { orgId, deleted: false }, - select: ["orgId", "workspaceSharingDisabled", "defaultWorkspaceImage", "allowedWorkspaceClasses"], + select: [ + "orgId", + "workspaceSharingDisabled", + "defaultWorkspaceImage", + "allowedWorkspaceClasses", + "pinnedEditorVersions", + ], }); } diff --git a/components/gitpod-protocol/src/teams-projects-protocol.ts b/components/gitpod-protocol/src/teams-projects-protocol.ts index db78fd4e5eebe8..484d9a865f98ad 100644 --- a/components/gitpod-protocol/src/teams-projects-protocol.ts +++ b/components/gitpod-protocol/src/teams-projects-protocol.ts @@ -204,6 +204,8 @@ export interface OrganizationSettings { // empty array to allow all kind of workspace classes allowedWorkspaceClasses?: string[] | null; + + pinnedEditorVersions?: { [key: string]: string } | null; } export type TeamMemberRole = OrgMemberRole;