From bc48b5da0bf075de63aa910ae918df933cfe9bea Mon Sep 17 00:00:00 2001 From: Jean Pierre Date: Thu, 30 Dec 2021 16:03:44 +0000 Subject: [PATCH] Update d_b_identity --- .../src/typeorm/migration/1592203031938-Baseline.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/gitpod-db/src/typeorm/migration/1592203031938-Baseline.ts b/components/gitpod-db/src/typeorm/migration/1592203031938-Baseline.ts index 3423bfe8a7d435..24c5f659ad3dc0 100644 --- a/components/gitpod-db/src/typeorm/migration/1592203031938-Baseline.ts +++ b/components/gitpod-db/src/typeorm/migration/1592203031938-Baseline.ts @@ -79,10 +79,14 @@ export class Baseline1592203031938 implements MigrationInterface { // probe user { - const exists = (await queryRunner.query(`SELECT COUNT(1) AS cnt FROM d_b_user WHERE id = 'builtin-user-workspace-probe-0000000'`))[0].cnt == 1; - if (!exists) { + const existsUser = (await queryRunner.query(`SELECT COUNT(1) AS cnt FROM d_b_user WHERE id = 'builtin-user-workspace-probe-0000000'`))[0].cnt == 1; + if (!existsUser) { await queryRunner.query(`INSERT IGNORE INTO d_b_user (id, creationDate, avatarUrl, name, fullName) VALUES ('${BUILTIN_WORKSPACE_PROBE_USER_ID}', '${new Date().toISOString()}', '', 'builtin-workspace-prober', '')`) } + const existsIdentity = (await queryRunner.query(`SELECT COUNT(1) AS cnt FROM d_b_identity WHERE userId = 'builtin-user-workspace-probe-0000000'`))[0].cnt == 1; + if (!existsIdentity) { + await queryRunner.query(`INSERT IGNORE INTO d_b_identity (authProviderId, authId, authName, userId) VALUES ('Public-GitHub', '12345678', 'builtin-workspace-prober', 'builtin-user-workspace-probe-0000000')`) + } } }