2024-10-02 05:32:13 -04:00
|
|
|
import Helpers from './lib/helpers.mjs'
|
2024-10-31 08:19:53 -04:00
|
|
|
import { getCollectionInternal } from '../app/src/infrastructure/mongodb.js'
|
2021-07-21 06:34:09 -04:00
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const tags = ['server-ce', 'server-pro', 'saas']
|
2021-07-21 06:34:09 -04:00
|
|
|
|
|
|
|
const indexes = [
|
|
|
|
{
|
|
|
|
unique: true,
|
|
|
|
key: {
|
|
|
|
doc_id: 1,
|
|
|
|
},
|
|
|
|
name: 'doc_id_1',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2024-10-31 08:19:53 -04:00
|
|
|
const migrate = async () => {
|
|
|
|
const docOps = await getCollectionInternal('docOps')
|
2024-01-31 10:44:02 -05:00
|
|
|
await Helpers.addIndexesToCollection(docOps, indexes)
|
2021-07-21 06:34:09 -04:00
|
|
|
}
|
|
|
|
|
2024-10-31 08:19:53 -04:00
|
|
|
const rollback = async () => {
|
|
|
|
const docOps = await getCollectionInternal('docOps')
|
2024-01-31 10:44:02 -05:00
|
|
|
await Helpers.dropIndexesFromCollection(docOps, indexes)
|
2021-07-21 06:34:09 -04:00
|
|
|
}
|
2024-10-02 05:32:13 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
tags,
|
|
|
|
migrate,
|
|
|
|
rollback,
|
|
|
|
}
|