2024-10-02 05:32:13 -04:00
|
|
|
import Helpers from './lib/helpers.mjs'
|
2022-09-29 05:47:50 -04:00
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const tags = ['server-ce', 'server-pro', 'saas']
|
2022-09-29 05:47:50 -04:00
|
|
|
|
|
|
|
const indexes = [
|
|
|
|
{
|
|
|
|
// expire after 2.5 years
|
|
|
|
expireAfterSeconds: 60 * 60 * 24 * 365 * 2.5,
|
|
|
|
key: {
|
|
|
|
timestamp: 1,
|
|
|
|
},
|
|
|
|
name: 'timestamp_1',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const migrate = async client => {
|
2022-09-29 05:47:50 -04:00
|
|
|
const { db } = client
|
|
|
|
await Helpers.addIndexesToCollection(db.projectAuditLogEntries, indexes)
|
|
|
|
await Helpers.addIndexesToCollection(db.userAuditLogEntries, indexes)
|
|
|
|
}
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const rollback = async client => {
|
2022-09-29 05:47:50 -04:00
|
|
|
const { db } = client
|
|
|
|
await Promise.all([
|
|
|
|
Helpers.dropIndexesFromCollection(db.userAuditLogEntries, indexes),
|
|
|
|
Helpers.dropIndexesFromCollection(db.projectAuditLogEntries, indexes),
|
|
|
|
])
|
|
|
|
}
|
2024-10-02 05:32:13 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
tags,
|
|
|
|
migrate,
|
|
|
|
rollback,
|
|
|
|
}
|