Skip to content

Commit

Permalink
Convert login value to string for number type logins.
Browse files Browse the repository at this point in the history
Fixes #688
  • Loading branch information
kabalin committed Jul 22, 2024
1 parent 6e84448 commit dd1dd06
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions migrations/20240721234721-cast_login_string.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright: The PastVu contributors.
* GNU Affero General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/agpl.txt)
*/

/**
* Cast login to string. We have some old numeric logins, they fail on profile
* viewing.
*/
module.exports = {
async up(db) {
await db.collection('users').updateMany({ login: { $type: 1 } }, [{ $set: { login: { $toString: '$login' } } }]);
},

async down() {
// No rollback.
},
};

0 comments on commit dd1dd06

Please sign in to comment.