-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[db/server] Link workspaces and projects
Co-authored-by: Jan Keromnes <[email protected]>
- Loading branch information
1 parent
a061798
commit 845cc1f
Showing
12 changed files
with
139 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
components/gitpod-db/src/typeorm/migration/1626422169862-AddProjectIdToWorkspace.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright (c) 2021 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, tableExists } from "./helper/helper"; | ||
|
||
export class AddProjectIdToWorkspace1626422169862 implements MigrationInterface { | ||
|
||
public async up(queryRunner: QueryRunner): Promise<any> { | ||
if (await tableExists(queryRunner, "d_b_workspace")) { | ||
if (!(await columnExists(queryRunner, "d_b_workspace", "projectId"))) { | ||
await queryRunner.query("ALTER TABLE d_b_workspace ADD COLUMN `projectId` char(36)"); | ||
} | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<any> { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Copyright (c) 2021 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 { PrebuiltWorkspaceState } from "./protocol"; | ||
import uuidv4 = require("uuid/v4"); | ||
|
||
export interface Project { | ||
id: string; | ||
name: string; | ||
cloneUrl: string; | ||
teamId: string; | ||
appInstallationId: string; | ||
creationTime: string; | ||
/** This is a flag that triggers the HARD DELETION of this entity */ | ||
deleted?: boolean; | ||
} | ||
|
||
export namespace Project { | ||
export const create = (project: Omit<Project, 'id' | 'creationTime'>): Project => { | ||
return { | ||
...project, | ||
id: uuidv4(), | ||
creationTime: new Date().toISOString() | ||
}; | ||
} | ||
} | ||
|
||
export interface ProjectInfo extends Project { | ||
lastPrebuild?: PrebuildInfo; | ||
} | ||
|
||
export interface PrebuildInfo { | ||
id: string; | ||
teamId: string; | ||
project: string; | ||
cloneUrl: string; | ||
branch: string; | ||
startedAt: string; | ||
startedBy: string; | ||
status: PrebuiltWorkspaceState; | ||
} | ||
|
||
export interface Team { | ||
id: string; | ||
name: string; | ||
slug: string; | ||
creationTime: string; | ||
/** This is a flag that triggers the HARD DELETION of this entity */ | ||
deleted?: boolean; | ||
} | ||
|
||
export type TeamMemberRole = "owner" | "member"; | ||
|
||
export interface TeamMemberInfo { | ||
userId: string; | ||
fullName?: string; | ||
primaryEmail?: string; | ||
avatarUrl?: string; | ||
role: TeamMemberRole; | ||
memberSince: string; | ||
} | ||
|
||
export interface TeamMembershipInvite { | ||
id: string; | ||
teamId: string; | ||
role: TeamMemberRole; | ||
creationTime: string; | ||
invalidationTime: string; | ||
invitedEmail?: string; | ||
|
||
/** This is a flag that triggers the HARD DELETION of this entity */ | ||
deleted?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters