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 @@ -81,12 +81,6 @@ export class GitpodTableDescriptionProvider implements TableDescriptionProvider
81
81
deletionColumn : "deleted" ,
82
82
timeColumn : "_lastModified" ,
83
83
} ,
84
- {
85
- name : "d_b_user_ssh_public_key" ,
86
- primaryKeys : [ "id" ] ,
87
- deletionColumn : "deleted" ,
88
- timeColumn : "_lastModified" ,
89
- } ,
90
84
{
91
85
name : "d_b_stripe_customer" ,
92
86
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 @@ -427,18 +427,18 @@ export class TypeORMUserDBImpl extends TransactionalDBImpl<UserDB> implements Us
427
427
428
428
public async hasSSHPublicKey ( userId : string ) : Promise < boolean > {
429
429
const repo = await this . getSSHPublicKeyRepo ( ) ;
430
- return ! ! ( await repo . findOne ( { where : { userId, deleted : false } } ) ) ;
430
+ return ! ! ( await repo . findOne ( { where : { userId } } ) ) ;
431
431
}
432
432
433
433
public async getSSHPublicKeys ( userId : string ) : Promise < UserSSHPublicKey [ ] > {
434
434
const repo = await this . getSSHPublicKeyRepo ( ) ;
435
- return repo . find ( { where : { userId, deleted : false } , order : { creationTime : "ASC" } } ) ;
435
+ return repo . find ( { where : { userId } , order : { creationTime : "ASC" } } ) ;
436
436
}
437
437
438
438
public async addSSHPublicKey ( userId : string , value : SSHPublicKeyValue ) : Promise < UserSSHPublicKey > {
439
439
const repo = await this . getSSHPublicKeyRepo ( ) ;
440
440
const fingerprint = SSHPublicKeyValue . getFingerprint ( value ) ;
441
- const allKeys = await repo . find ( { where : { userId, deleted : false } } ) ;
441
+ const allKeys = await repo . find ( { where : { userId } } ) ;
442
442
const prevOne = allKeys . find ( ( e ) => e . fingerprint === fingerprint ) ;
443
443
if ( ! ! prevOne ) {
444
444
throw new Error ( `Key already in use` ) ;
You can’t perform that action at this time.
0 commit comments