File tree Expand file tree Collapse file tree 4 files changed +30
-13
lines changed Expand file tree Collapse file tree 4 files changed +30
-13
lines changed Original file line number Diff line number Diff line change @@ -86,12 +86,6 @@ export class GitpodTableDescriptionProvider implements TableDescriptionProvider
86
86
deletionColumn : "deleted" ,
87
87
timeColumn : "_lastModified" ,
88
88
} ,
89
- {
90
- name : "d_b_user_ssh_public_key" ,
91
- primaryKeys : [ "id" ] ,
92
- deletionColumn : "deleted" ,
93
- timeColumn : "_lastModified" ,
94
- } ,
95
89
{
96
90
name : "d_b_stripe_customer" ,
97
91
primaryKeys : [ "stripeCustomerId" ] ,
Original file line number Diff line number Diff line change @@ -49,8 +49,4 @@ export class DBUserSshPublicKey implements UserSSHPublicKey {
49
49
transformer : Transformer . MAP_EMPTY_STR_TO_UNDEFINED ,
50
50
} )
51
51
lastUsedTime ?: string ;
52
-
53
- // This column triggers the periodic deleter deletion mechanism. It's not intended for public consumption.
54
- @Column ( )
55
- deleted : boolean ;
56
52
}
Original file line number Diff line number Diff line change
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_user_ssh_public_key" ;
11
+ const COLUMN_NAME = "deleted" ;
12
+
13
+ export class UserSshPublicKeyDropDeleted1695822248160 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
+ }
Original file line number Diff line number Diff line change @@ -425,18 +425,18 @@ export class TypeORMUserDBImpl extends TransactionalDBImpl<UserDB> implements Us
425
425
426
426
public async hasSSHPublicKey ( userId : string ) : Promise < boolean > {
427
427
const repo = await this . getSSHPublicKeyRepo ( ) ;
428
- return ! ! ( await repo . findOne ( { where : { userId, deleted : false } } ) ) ;
428
+ return ! ! ( await repo . findOne ( { where : { userId } } ) ) ;
429
429
}
430
430
431
431
public async getSSHPublicKeys ( userId : string ) : Promise < UserSSHPublicKey [ ] > {
432
432
const repo = await this . getSSHPublicKeyRepo ( ) ;
433
- return repo . find ( { where : { userId, deleted : false } , order : { creationTime : "ASC" } } ) ;
433
+ return repo . find ( { where : { userId } , order : { creationTime : "ASC" } } ) ;
434
434
}
435
435
436
436
public async addSSHPublicKey ( userId : string , value : SSHPublicKeyValue ) : Promise < UserSSHPublicKey > {
437
437
const repo = await this . getSSHPublicKeyRepo ( ) ;
438
438
const fingerprint = SSHPublicKeyValue . getFingerprint ( value ) ;
439
- const allKeys = await repo . find ( { where : { userId, deleted : false } } ) ;
439
+ const allKeys = await repo . find ( { where : { userId } } ) ;
440
440
const prevOne = allKeys . find ( ( e ) => e . fingerprint === fingerprint ) ;
441
441
if ( ! ! prevOne ) {
442
442
throw new Error ( `Key already in use` ) ;
You can’t perform that action at this time.
0 commit comments