Skip to content

Commit 67b9f01

Browse files
committed
Regen
1 parent 6359a74 commit 67b9f01

24 files changed

+103
-729
lines changed

components/gitpod-db/src/pending-github-event-db.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
import { PendingGithubEvent, User, Identity } from '@gitpod/gitpod-protocol';
88
import { EntityManager } from 'typeorm';
99

10-
export type PendingGithubEventWithUser = PendingGithubEvent & {
11-
identity: Identity & { user: User };
12-
};
10+
export type PendingGithubEventWithUser = PendingGithubEvent & { identity: Identity & { user: User } };
1311

1412
export const TransactionalPendingGithubEventDBFactory = Symbol('TransactionalPendingGithubEventDBFactory');
1513
export interface TransactionalPendingGithubEventDBFactory {

components/gitpod-db/src/periodic-deleter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import { repeat } from '@gitpod/gitpod-protocol/lib/util/repeat';
1313

1414
@injectable()
1515
export class PeriodicDbDeleter {
16-
@inject(GitpodTableDescriptionProvider)
17-
protected readonly tableProvider: GitpodTableDescriptionProvider;
16+
@inject(GitpodTableDescriptionProvider) protected readonly tableProvider: GitpodTableDescriptionProvider;
1817
@inject(TypeORM) protected readonly typeORM: TypeORM;
1918

2019
start() {

components/gitpod-db/src/typeorm/accounting-db-impl.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import { TypeORM } from './typeorm';
2323
@injectable()
2424
export class TypeORMAccountingDBImpl implements AccountingDB {
2525
@inject(TypeORM) typeORM: TypeORM;
26-
@inject(TransactionalAccountingDBFactory)
27-
protected readonly transactionalFactory: TransactionalAccountingDBFactory;
26+
@inject(TransactionalAccountingDBFactory) protected readonly transactionalFactory: TransactionalAccountingDBFactory;
2827

2928
async transaction<T>(
3029
closure: (db: AccountingDB) => Promise<T>,
@@ -220,9 +219,7 @@ export class TypeORMAccountingDBImpl implements AccountingDB {
220219
return (await this.getSubscriptionRepo())
221220
.createQueryBuilder('subscription')
222221
.where('subscription.userId = :userId ', { userId: userId })
223-
.andWhere('subscription.paymentReference = :paymentReference', {
224-
paymentReference,
225-
})
222+
.andWhere('subscription.paymentReference = :paymentReference', { paymentReference })
226223
.andWhere('subscription.deleted != true')
227224
.andWhere('subscription.planId != "free"') // TODO DEL FREE-SUBS
228225
.orderBy('subscription.startDate', 'DESC')

components/gitpod-db/src/typeorm/app-installation-db-impl.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ export class TypeORMAppInstallationDBImpl implements AppInstallationDB {
5151
const repo = await this.getRepo();
5252
const qb = repo
5353
.createQueryBuilder('installation')
54-
.where('installation.installationID = :installationID', {
55-
installationID,
56-
})
54+
.where('installation.installationID = :installationID', { installationID })
5755
.andWhere('installation.state != "uninstalled"')
5856
.orderBy('installation.lastUpdateTime', 'DESC')
5957
.limit(1);
@@ -68,10 +66,7 @@ export class TypeORMAppInstallationDBImpl implements AppInstallationDB {
6866
) {
6967
const installation = await this.findInstallation(platform, installationID);
7068
if (!installation) {
71-
log.warn('Cannot record uninstallation of non-existent installation', {
72-
platform,
73-
installationID,
74-
});
69+
log.warn('Cannot record uninstallation of non-existent installation', { platform, installationID });
7570
return;
7671
}
7772

components/gitpod-db/src/typeorm/code-sync-resource-db.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ export class CodeSyncResourceDB {
3232
.addSelect('resource2.kind')
3333
.addSelect('max(resource2.created)')
3434
.from(DBCodeSyncResource, 'resource2')
35-
.where('resource2.userId = :userId AND resource2.deleted = 0', {
36-
userId,
37-
})
35+
.where('resource2.userId = :userId AND resource2.deleted = 0', { userId })
3836
.groupBy('resource2.kind')
3937
.orderBy('resource2.created', 'DESC')
4038
.getQuery();
@@ -102,11 +100,7 @@ export class CodeSyncResourceDB {
102100
.createQueryBuilder()
103101
.update(DBCodeSyncResource)
104102
.set({ rev })
105-
.where('userId = :userId AND kind = :kind AND rev = :rev', {
106-
userId,
107-
kind,
108-
rev: toUpdated.rev,
109-
})
103+
.where('userId = :userId AND kind = :kind AND rev = :rev', { userId, kind, rev: toUpdated.rev })
110104
.execute();
111105
} else {
112106
await manager

components/gitpod-db/src/typeorm/entity/db-prebuilt-workspace-updatable.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,17 @@ export class DBPrebuiltWorkspaceUpdatable implements PrebuiltWorkspaceUpdatable
3030
@Column()
3131
repo: string;
3232

33-
@Column()
34-
isResolved: boolean;
35-
36-
<<<<<<< HEAD
37-
<<<<<<< HEAD
3833
@Column({
3934
default: '',
40-
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED
35+
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED,
4136
})
4237
commitSHA?: string;
4338

4439
@Column()
4540
isResolved: boolean;
46-
=======
47-
@Column()
48-
installationId: string;
49-
>>>>>>> 083c5c5e (Reformat gitpod-db with prettier)
50-
=======
41+
5142
@Column()
5243
installationId: string;
53-
>>>>>>> 3e7b850b (regen)
5444

5545
@Column({
5646
default: '',

components/gitpod-db/src/typeorm/entity/db-prebuilt-workspace.ts

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,17 @@
66

77
import { PrimaryColumn, Column, Entity, Index } from 'typeorm';
88

9-
<<<<<<< HEAD
10-
import {
11-
PrebuiltWorkspace,
12-
PrebuiltWorkspaceState,
13-
} from "@gitpod/gitpod-protocol";
14-
import { TypeORM } from "../typeorm";
15-
import { Transformer } from "../transformer";
16-
import { PrebuildWorkspaceRateLimiterMigration1646739309660 } from "../migration/1646739309660-PrebuildWorskace-rate-limiter-migration";
17-
18-
@Entity()
19-
@Index("ind_ac4a9aece1a455da0dc653888f", ["cloneURL", "commit"])
20-
@Index(PrebuildWorkspaceRateLimiterMigration1646739309660.INDEX_NAME, PrebuildWorkspaceRateLimiterMigration1646739309660.FIELDS)
21-
=======
229
import { PrebuiltWorkspace, PrebuiltWorkspaceState } from '@gitpod/gitpod-protocol';
2310
import { TypeORM } from '../typeorm';
2411
import { Transformer } from '../transformer';
12+
import { PrebuildWorkspaceRateLimiterMigration1646739309660 } from '../migration/1646739309660-PrebuildWorskace-rate-limiter-migration';
2513

2614
@Entity()
2715
@Index('ind_ac4a9aece1a455da0dc653888f', ['cloneURL', 'commit'])
28-
>>>>>>> 3e7b850b (regen)
16+
@Index(
17+
PrebuildWorkspaceRateLimiterMigration1646739309660.INDEX_NAME,
18+
PrebuildWorkspaceRateLimiterMigration1646739309660.FIELDS,
19+
)
2920
// on DB but not Typeorm: @Index("ind_lastModified", ["_lastModified"]) // DBSync
3021
export class DBPrebuiltWorkspace implements PrebuiltWorkspace {
3122
@PrimaryColumn(TypeORM.UUID_COLUMN_TYPE)
@@ -72,31 +63,9 @@ export class DBPrebuiltWorkspace implements PrebuiltWorkspace {
7263
})
7364
snapshot?: string;
7465

75-
<<<<<<< HEAD
76-
<<<<<<< HEAD
77-
@Column({
78-
default: '',
79-
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED
80-
})
81-
snapshot?: string;
82-
83-
@Column({
84-
default: '',
85-
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED
86-
})
87-
error?: string;
88-
=======
89-
@Column({
90-
default: "",
91-
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED,
92-
})
93-
error?: string;
94-
>>>>>>> 083c5c5e (Reformat gitpod-db with prettier)
95-
=======
9666
@Column({
9767
default: '',
9868
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED,
9969
})
10070
error?: string;
101-
>>>>>>> 3e7b850b (regen)
10271
}

components/gitpod-db/src/typeorm/migration/1616920059049-UpdateExamples.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ export class UpdateExamples1616920059049 implements MigrationInterface {
3434
description: 'A simple .NET Core application example',
3535
priority: 20,
3636
},
37-
{
38-
url: 'https://github.com/symfony/demo',
39-
description: 'A Symfony demo application',
40-
priority: 10,
41-
},
37+
{ url: 'https://github.com/symfony/demo', description: 'A Symfony demo application', priority: 10 },
4238
];
4339
// delete old entries
4440
await queryRunner.query('DELETE FROM d_b_repository_white_list');

components/gitpod-db/src/typeorm/migration/1646739309660-PrebuildWorskace-rate-limiter-migration.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,29 @@
44
* See License-AGPL.txt in the project root for license information.
55
*/
66

7-
import {MigrationInterface, QueryRunner} from "typeorm";
8-
import { indexExists } from "./helper/helper";
7+
import { MigrationInterface, QueryRunner } from 'typeorm';
8+
import { indexExists } from './helper/helper';
99

1010
export class PrebuildWorkspaceRateLimiterMigration1646739309660 implements MigrationInterface {
11-
12-
public static readonly TABLE_NAME = "d_b_prebuilt_workspace";
13-
public static readonly INDEX_NAME = "ind_prebuiltWorkspace_cloneURL_creationTime_state";
14-
public static readonly FIELDS = ["cloneURL", "creationTime", "state"];
11+
public static readonly TABLE_NAME = 'd_b_prebuilt_workspace';
12+
public static readonly INDEX_NAME = 'ind_prebuiltWorkspace_cloneURL_creationTime_state';
13+
public static readonly FIELDS = ['cloneURL', 'creationTime', 'state'];
1514

1615
public async up(queryRunner: QueryRunner): Promise<void> {
17-
if(!(await indexExists(queryRunner, PrebuildWorkspaceRateLimiterMigration1646739309660.TABLE_NAME, PrebuildWorkspaceRateLimiterMigration1646739309660.INDEX_NAME))) {
18-
await queryRunner.query(`CREATE INDEX ${PrebuildWorkspaceRateLimiterMigration1646739309660.INDEX_NAME} ON ${PrebuildWorkspaceRateLimiterMigration1646739309660.TABLE_NAME} (${PrebuildWorkspaceRateLimiterMigration1646739309660.FIELDS.join(', ')})`);
16+
if (
17+
!(await indexExists(
18+
queryRunner,
19+
PrebuildWorkspaceRateLimiterMigration1646739309660.TABLE_NAME,
20+
PrebuildWorkspaceRateLimiterMigration1646739309660.INDEX_NAME,
21+
))
22+
) {
23+
await queryRunner.query(
24+
`CREATE INDEX ${PrebuildWorkspaceRateLimiterMigration1646739309660.INDEX_NAME} ON ${
25+
PrebuildWorkspaceRateLimiterMigration1646739309660.TABLE_NAME
26+
} (${PrebuildWorkspaceRateLimiterMigration1646739309660.FIELDS.join(', ')})`,
27+
);
1928
}
2029
}
2130

2231
public async down(queryRunner: QueryRunner): Promise<void> {}
23-
2432
}

components/gitpod-db/src/typeorm/migration/1646803519382-PrebuildUpdatableSHA.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
* See License-AGPL.txt in the project root for license information.
55
*/
66

7-
import {MigrationInterface, QueryRunner} from "typeorm";
8-
import { columnExists } from "./helper/helper";
7+
import { MigrationInterface, QueryRunner } from 'typeorm';
8+
import { columnExists } from './helper/helper';
99

1010
export class PrebuildUpdatableSHA1646803519382 implements MigrationInterface {
11-
1211
public async up(queryRunner: QueryRunner): Promise<void> {
13-
if (!(await columnExists(queryRunner, "d_b_prebuilt_workspace_updatable", "commitSHA"))) {
14-
await queryRunner.query("ALTER TABLE d_b_prebuilt_workspace_updatable ADD COLUMN commitSHA varchar(255) NOT NULL DEFAULT ''");
12+
if (!(await columnExists(queryRunner, 'd_b_prebuilt_workspace_updatable', 'commitSHA'))) {
13+
await queryRunner.query(
14+
"ALTER TABLE d_b_prebuilt_workspace_updatable ADD COLUMN commitSHA varchar(255) NOT NULL DEFAULT ''",
15+
);
1516
}
1617
}
1718

18-
public async down(queryRunner: QueryRunner): Promise<void> {
19-
}
20-
19+
public async down(queryRunner: QueryRunner): Promise<void> {}
2120
}

0 commit comments

Comments
 (0)