Skip to content

Commit

Permalink
fixes on migration
Browse files Browse the repository at this point in the history
  • Loading branch information
lelemm committed Nov 25, 2024
1 parent 979c597 commit c4d9dab
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions migrations/1719409568000-multiuser.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const up = async function () {
);

let sessionRow = accountDb.first(
'SELECT * FROM sessions WHERE auth_method = ?',
['password'],
'SELECT * FROM sessions WHERE auth_method IS NULL',
);

let token = sessionRow ? sessionRow.token : uuid.v4();
Expand All @@ -51,8 +50,8 @@ export const up = async function () {
);

accountDb.mutate(
'UPDATE sessions SET user_id = ?, expires_at = ? WHERE token = ?',
[userId, -1, token],
'UPDATE sessions SET user_id = ?, expires_at = ?, auth_method = ? WHERE token = ?',
[userId, -1, 'password', token],
);
});
};
Expand Down

0 comments on commit c4d9dab

Please sign in to comment.