From 2fb5a617393ddbc9d63b2a6c8417b0d302721ec1 Mon Sep 17 00:00:00 2001 From: "Laurie T. Malau" Date: Fri, 13 Aug 2021 14:50:33 +0000 Subject: [PATCH] Replace also if additionalData is null --- .../1628674695873-DeprecateAllowsMarketingCommunication.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/gitpod-db/src/typeorm/migration/1628674695873-DeprecateAllowsMarketingCommunication.ts b/components/gitpod-db/src/typeorm/migration/1628674695873-DeprecateAllowsMarketingCommunication.ts index b5061e89c4035b..14200d16c2fce4 100644 --- a/components/gitpod-db/src/typeorm/migration/1628674695873-DeprecateAllowsMarketingCommunication.ts +++ b/components/gitpod-db/src/typeorm/migration/1628674695873-DeprecateAllowsMarketingCommunication.ts @@ -11,7 +11,7 @@ export class DeprecateAllowsMarketingCommunication1628674695873 implements Migra public async up(queryRunner: QueryRunner): Promise { if (await columnExists(queryRunner, "d_b_user", "allowsMarketingCommunication")) { - await queryRunner.query("UPDATE d_b_user set additionalData = JSON_MERGE_PATCH(additionalData, JSON_SET('{\"emailNotificationSettings\":{\"allowsChangelogMail\":true}}', '$.emailNotificationSettings.allowsChangelogMail', IF(allowsMarketingCommunication, 'true', 'false')))"); + await queryRunner.query("UPDATE d_b_user set additionalData = JSON_MERGE_PATCH(IFNULL(additionalData, '{}'), JSON_SET('{\"emailNotificationSettings\":{\"allowsChangelogMail\":true}}', '$.emailNotificationSettings.allowsChangelogMail', IF(allowsMarketingCommunication, 'true', 'false')))"); await queryRunner.query("ALTER TABLE d_b_user DROP COLUMN allowsMarketingCommunication"); } }