2023-02-27 10:49:44 -05:00
|
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
import Helpers from './lib/helpers.mjs'
|
2023-02-27 10:49:44 -05:00
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const tags = ['saas']
|
2023-02-27 10:49:44 -05:00
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const migrate = async client => {
|
2023-02-27 10:49:44 -05:00
|
|
|
const { db } = client
|
|
|
|
db.subscriptions.updateMany(
|
|
|
|
{
|
|
|
|
'teamInvites.0': {
|
|
|
|
$exists: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[
|
|
|
|
{
|
|
|
|
$set: {
|
|
|
|
teamInvites: {
|
|
|
|
$map: {
|
|
|
|
input: '$teamInvites',
|
|
|
|
in: {
|
|
|
|
$mergeObjects: [
|
|
|
|
'$$this',
|
|
|
|
{
|
|
|
|
email: {
|
|
|
|
$toLower: '$$this.email',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const rollback = async client => {
|
2023-02-27 10:49:44 -05:00
|
|
|
// There is no way back.
|
|
|
|
}
|
2024-10-02 05:32:13 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
tags,
|
|
|
|
migrate,
|
|
|
|
rollback,
|
|
|
|
}
|