Adds deleted filter to docs index

GitOrigin-RevId: bd00fa383946c3a2aa7b03f355aad399bbe9cdca
This commit is contained in:
Andrew Rumble
2025-03-21 10:21:15 +00:00
committed by Copybot
parent 1ab8302254
commit 7eb5c8a38e

View File

@@ -0,0 +1,31 @@
import Helpers from './lib/helpers.mjs'
const tags = ['server-ce', 'server-pro', 'saas']
const oldIndex = {
key: { project_id: 1, inS3: 1 },
name: 'project_id_1_inS3_1',
}
const newIndex = {
key: { project_id: 1, inS3: 1, deleted: 1 },
name: 'project_id_1_inS3_1_deleted_1',
}
const migrate = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.docs, [newIndex])
await Helpers.dropIndexesFromCollection(db.docs, [oldIndex])
}
const rollback = async client => {
const { db } = client
await Helpers.addIndexesToCollection(db.docs, [oldIndex])
await Helpers.dropIndexesFromCollection(db.docs, [newIndex])
}
export default {
tags,
migrate,
rollback,
}