20250203164153_create_project_pendingChangeAt_index.mjs 625 B

12345678910111213141516171819202122232425262728293031
  1. /* eslint-disable no-unused-vars */
  2. import Helpers from './lib/helpers.mjs'
  3. const tags = ['saas']
  4. const indexes = [
  5. {
  6. key: { 'overleaf.backup.pendingChangeAt': 1 },
  7. name: 'overleaf_backup_pendingChangeAt_1',
  8. partialFilterExpression: {
  9. 'overleaf.backup.pendingChangeAt': { $exists: true },
  10. },
  11. },
  12. ]
  13. const migrate = async client => {
  14. const { db } = client
  15. await Helpers.addIndexesToCollection(db.projects, indexes)
  16. }
  17. const rollback = async client => {
  18. const { db } = client
  19. await Helpers.dropIndexesFromCollection(db.projects, indexes)
  20. }
  21. export default {
  22. tags,
  23. migrate,
  24. rollback,
  25. }