2022-11-28 10:05:30 -05:00
|
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
import Helpers from './lib/helpers.mjs'
|
2022-11-28 10:05:30 -05:00
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const 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-02 05:32:13 -04:00
|
|
|
const migrate = async ({ db }) => {
|
2022-11-28 10:05:30 -05:00
|
|
|
await Helpers.addIndexesToCollection(db.projectHistoryChunks, indexes)
|
|
|
|
}
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const rollback = async ({ db }) => {
|
2022-11-28 10:05:30 -05:00
|
|
|
await Helpers.dropIndexesFromCollection(db.projectHistoryChunks, indexes)
|
|
|
|
}
|
2024-10-02 05:32:13 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
tags,
|
|
|
|
migrate,
|
|
|
|
rollback,
|
|
|
|
}
|