Skip to content

Commit

Permalink
fix(core): Fix AddActivatedAtUserSetting migration on MariaDB (#9910)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy authored and cstuncsik committed Jul 3, 2024
1 parent 2661c24 commit 7095c6d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export class AddActivatedAtUserSetting1717498465931 implements ReversibleMigrati
const now = Date.now();
await queryRunner.query(
`UPDATE ${escape.tableName('user')}
SET settings = JSON_SET(COALESCE(settings, '{}'), '$.userActivatedAt', CAST('${now}' AS JSON))
SET settings = JSON_SET(COALESCE(settings, '{}'), '$.userActivatedAt', '${now}')
WHERE settings IS NOT NULL AND JSON_EXTRACT(settings, '$.userActivated') = true`,
);
}

async down({ queryRunner, escape }: MigrationContext) {
await queryRunner.query(
`UPDATE ${escape.tableName('user')}
SET settings = JSON_REMOVE(CAST(settings AS JSON), '$.userActivatedAt')
SET settings = JSON_REMOVE(settings, '$.userActivatedAt')
WHERE settings IS NOT NULL`,
);
}
Expand Down

0 comments on commit 7095c6d

Please sign in to comment.