Skip to content

Commit fef01cc

Browse files
author
Laurie T. Malau
committed
Replace also if additionalData is null
1 parent a60a42e commit fef01cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/gitpod-db/src/typeorm/migration/1628674695873-DeprecateAllowsMarketingCommunication.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class DeprecateAllowsMarketingCommunication1628674695873 implements Migra
1111

1212
public async up(queryRunner: QueryRunner): Promise<any> {
1313
if (await columnExists(queryRunner, "d_b_user", "allowsMarketingCommunication")) {
14-
await queryRunner.query("UPDATE d_b_user set additionalData = JSON_MERGE_PATCH(additionalData, JSON_SET('{\"emailNotificationSettings\":{\"allowsChangelogMail\":true}}', '$.emailNotificationSettings.allowsChangelogMail', IF(allowsMarketingCommunication, 'true', 'false')))");
14+
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')))");
1515
await queryRunner.query("ALTER TABLE d_b_user DROP COLUMN allowsMarketingCommunication");
1616
}
1717
}

0 commit comments

Comments
 (0)