Skip to content

Commit

Permalink
fix(core): Fix bug running addUserActivatedColumn migration on MariaDB (
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoE105 authored and netroy committed May 3, 2023
1 parent 6ca7482 commit aa8e96d
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ export class AddUserActivatedProperty1681134145996 implements MigrationInterface
AND r.scope = 'workflow'`,
);

const updatedUsers = activatedUsers.map((user) =>
const updatedUsers = activatedUsers.map((user) => {
/*
MariaDB returns settings as a string and MySQL as a JSON
*/
const userSettings =
typeof user.settings === 'string' ? user.settings : JSON.stringify(user.settings);
queryRunner.query(
`UPDATE ${tablePrefix}user SET settings = '${JSON.stringify(user.settings)}' WHERE id = '${
user.id
}' `,
),
);
`UPDATE ${tablePrefix}user SET settings = '${userSettings}' WHERE id = '${user.id}' `,
);
});

await Promise.all(updatedUsers);

Expand Down

0 comments on commit aa8e96d

Please sign in to comment.