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