diff --git a/services/web/migrations/20250321092555_add_deleted_to_project_id_in_s3_index.mjs b/services/web/migrations/20250321092555_add_deleted_to_project_id_in_s3_index.mjs new file mode 100644 index 0000000000..871775cb1b --- /dev/null +++ b/services/web/migrations/20250321092555_add_deleted_to_project_id_in_s3_index.mjs @@ -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, +}