20250212144722_clear_history_metadata.mjs 626 B

123456789101112131415161718192021222324252627282930
  1. /* eslint-disable no-unused-vars */
  2. import { batchedUpdate } from '@overleaf/mongo-utils/batchedUpdate.js'
  3. const tags = ['saas']
  4. const migrate = async client => {
  5. const { db } = client
  6. await batchedUpdate(
  7. db.projects,
  8. { 'overleaf.history.currentEndVersion': { $exists: true } },
  9. {
  10. $unset: {
  11. 'overleaf.history.currentEndVersion': true,
  12. 'overleaf.history.currentEndTimestamp': true,
  13. 'overleaf.history.updatedAt': true,
  14. 'overleaf.backup.pendingChangeAt': true,
  15. },
  16. }
  17. )
  18. }
  19. const rollback = async client => {}
  20. export default {
  21. tags,
  22. migrate,
  23. rollback,
  24. }