mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #11711 from overleaf/tm-invite-emails-lowercase-readd-migration
Re-add migration that ensures group invite emails are lowercase GitOrigin-RevId: 60edac2c6f565930da7d3f205978be0a78f5e80f
This commit is contained in:
parent
16b2d27fde
commit
41b5bb5bae
1 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,41 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
|
||||
const Helpers = require('./lib/helpers')
|
||||
|
||||
exports.tags = ['saas']
|
||||
|
||||
exports.migrate = async client => {
|
||||
const { db } = client
|
||||
db.subscriptions.updateMany(
|
||||
{
|
||||
'teamInvites.0': {
|
||||
$exists: true,
|
||||
},
|
||||
},
|
||||
[
|
||||
{
|
||||
$set: {
|
||||
teamInvites: {
|
||||
$map: {
|
||||
input: '$teamInvites',
|
||||
in: {
|
||||
$mergeObjects: [
|
||||
'$$this',
|
||||
{
|
||||
email: {
|
||||
$toLower: '$$this.email',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
exports.rollback = async client => {
|
||||
// There is no way back.
|
||||
}
|
Loading…
Reference in a new issue