[web] Add expiration for groupAuditLogEntries collection (#27437)

Set to 2.5 years, same as user/project audit logs

GitOrigin-RevId: d3b7e6d752eda4b224068e7b37276e79b4143464
This commit is contained in:
Miguel Serrano
2025-07-31 10:33:02 +02:00
committed by Copybot
parent 5ebe8563ed
commit 0832e35196

View File

@@ -0,0 +1,32 @@
import Helpers from './lib/helpers.mjs'
const tags = ['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.groupAuditLogEntries, indexes)
}
const rollback = async client => {
const { db } = client
await Promise.all([
Helpers.dropIndexesFromCollection(db.groupAuditLogEntries, indexes),
])
}
export default {
tags,
migrate,
rollback,
}