diff --git a/migrations/20240721234722-login_to_string.js b/migrations/20240721234722-login_to_string.js new file mode 100644 index 00000000..93d4b181 --- /dev/null +++ b/migrations/20240721234722-login_to_string.js @@ -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) + */ + +/** + * Update numeric 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. + }, +};