20220105123000_cleanup_unused_collections.mjs 734 B

1234567891011121314151617181920212223242526272829303132333435
  1. import Helpers from './lib/helpers.mjs'
  2. const tags = ['saas']
  3. const unusedCollections = [
  4. 'collaberatorcount',
  5. 'db.subscriptions',
  6. 'projectsDeletedByMigration',
  7. 'readonlycount',
  8. 'samllog',
  9. 'sharelatex-production.docOps.2013-12-17T02-26-49.0',
  10. 'sharelatex-production.projects.2013-12-17T02-26-49.1',
  11. 'sharelatex-production.users.2013-12-17T02-26-49.2',
  12. 'sharelatex_production.users',
  13. 'totalwords',
  14. 'user',
  15. 'usersDeletedByMigration',
  16. 'usersEmailDomains',
  17. ]
  18. const migrate = async () => {
  19. for (const name of unusedCollections) {
  20. await Helpers.dropCollection(name)
  21. }
  22. }
  23. const rollback = async () => {
  24. // We lost the indexes. There is no way back.
  25. }
  26. export default {
  27. tags,
  28. migrate,
  29. rollback,
  30. }