2024-10-02 05:32:13 -04:00
|
|
|
const tags = ['saas']
|
2023-10-27 09:11:25 -04:00
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const migrate = async client => {
|
2023-10-27 09:11:25 -04:00
|
|
|
const { db } = client
|
|
|
|
await db.ssoConfigs.updateMany(
|
|
|
|
{ certificate: { $exists: true }, certificates: { $exists: false } },
|
|
|
|
[
|
|
|
|
{ $set: { certificates: ['$certificate'] } },
|
|
|
|
{
|
|
|
|
$unset: 'certificate',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
)
|
|
|
|
await db.ssoConfigs.updateMany(
|
|
|
|
{ userFirstNameAttribute: null },
|
|
|
|
{ $unset: { userFirstNameAttribute: true } }
|
|
|
|
)
|
|
|
|
await db.ssoConfigs.updateMany(
|
|
|
|
{ userLastNameAttribute: null },
|
|
|
|
{ $unset: { userLastNameAttribute: true } }
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const rollback = async client => {
|
2023-10-27 09:11:25 -04:00
|
|
|
const { db } = client
|
|
|
|
await db.ssoConfigs.updateMany(
|
|
|
|
{ certificate: { $exists: false }, certificates: { $exists: true } },
|
|
|
|
[
|
|
|
|
{ $set: { certificate: { $arrayElemAt: ['$certificates', 0] } } },
|
|
|
|
{
|
|
|
|
$unset: 'certificates',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
)
|
|
|
|
}
|
2024-10-02 05:32:13 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
tags,
|
|
|
|
migrate,
|
|
|
|
rollback,
|
|
|
|
}
|