mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 06:05:23 -05:00
9e15c73228
Revert "Revert "Convert migration scripts to ESM"" GitOrigin-RevId: 0430a3cd02b9d23bf0f4573346351dcf4ee17fa6
34 lines
758 B
JavaScript
34 lines
758 B
JavaScript
import Helpers from './lib/helpers.mjs'
|
|
|
|
const tags = ['server-ce', 'server-pro', 'saas']
|
|
|
|
const indexes = [
|
|
{
|
|
// expire after 2.5 years
|
|
expireAfterSeconds: 60 * 60 * 24 * 365 * 2.5,
|
|
key: {
|
|
timestamp: 1,
|
|
},
|
|
name: 'timestamp_1',
|
|
},
|
|
]
|
|
|
|
const migrate = async client => {
|
|
const { db } = client
|
|
await Helpers.addIndexesToCollection(db.projectAuditLogEntries, indexes)
|
|
await Helpers.addIndexesToCollection(db.userAuditLogEntries, indexes)
|
|
}
|
|
|
|
const rollback = async client => {
|
|
const { db } = client
|
|
await Promise.all([
|
|
Helpers.dropIndexesFromCollection(db.userAuditLogEntries, indexes),
|
|
Helpers.dropIndexesFromCollection(db.projectAuditLogEntries, indexes),
|
|
])
|
|
}
|
|
|
|
export default {
|
|
tags,
|
|
migrate,
|
|
rollback,
|
|
}
|