2022-11-28 10:05:30 -05:00
|
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
|
2024-10-01 05:53:36 -04:00
|
|
|
const Helpers = require('./lib/helpers')
|
2022-11-28 10:05:30 -05:00
|
|
|
|
2024-10-01 05:53:36 -04:00
|
|
|
exports.tags = ['server-ce', 'server-pro', 'saas']
|
2022-11-28 10:05:30 -05:00
|
|
|
|
|
|
|
const indexes = [
|
|
|
|
{
|
|
|
|
key: { projectId: 1, startVersion: 1 },
|
|
|
|
name: 'projectId_1_startVersion_1',
|
|
|
|
partialFilterExpression: { state: 'active' },
|
|
|
|
unique: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: { state: 1 },
|
|
|
|
name: 'state_1',
|
|
|
|
partialFilterExpression: { state: 'deleted' },
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2024-10-01 05:53:36 -04:00
|
|
|
exports.migrate = async ({ db }) => {
|
2022-11-28 10:05:30 -05:00
|
|
|
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
|
|
|
|
}
|
|
|
|
|
2024-10-01 05:53:36 -04:00
|
|
|
exports.rollback = async ({ db }) => {
|
2022-11-28 10:05:30 -05:00
|
|
|
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
|
|
|
|
}
|