Skip to content

Commit

Permalink
Replace also if additionalData is null
Browse files Browse the repository at this point in the history
  • Loading branch information
laushinka committed Aug 16, 2021
1 parent d5f624c commit 2fb5a61
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DeprecateAllowsMarketingCommunication1628674695873 implements Migra

public async up(queryRunner: QueryRunner): Promise<any> {
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");
}
}
Expand Down

0 comments on commit 2fb5a61

Please sign in to comment.