fix(core): Fix AddActivatedAtUserSetting migration on MariaDB (#9910)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-07-02 15:25:49 +02:00 committed by GitHub
parent abb74587db
commit db29e84666
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,7 +5,7 @@ export class AddActivatedAtUserSetting1717498465931 implements ReversibleMigrati
const now = Date.now(); const now = Date.now();
await queryRunner.query( await queryRunner.query(
`UPDATE ${escape.tableName('user')} `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`, WHERE settings IS NOT NULL AND JSON_EXTRACT(settings, '$.userActivated') = true`,
); );
} }
@ -13,7 +13,7 @@ export class AddActivatedAtUserSetting1717498465931 implements ReversibleMigrati
async down({ queryRunner, escape }: MigrationContext) { async down({ queryRunner, escape }: MigrationContext) {
await queryRunner.query( await queryRunner.query(
`UPDATE ${escape.tableName('user')} `UPDATE ${escape.tableName('user')}
SET settings = JSON_REMOVE(CAST(settings AS JSON), '$.userActivatedAt') SET settings = JSON_REMOVE(settings, '$.userActivatedAt')
WHERE settings IS NOT NULL`, WHERE settings IS NOT NULL`,
); );
} }