overleaf/services/web/migrations/20220105123000_cleanup_unused_collections.mjs
Liangjun Song 9e15c73228 Merge pull request #20732 from overleaf/revert-20731-revert-20480-ls-convert-migration-scripts-to-esm
Revert "Revert "Convert migration scripts to ESM""

GitOrigin-RevId: 0430a3cd02b9d23bf0f4573346351dcf4ee17fa6
2024-10-14 10:58:50 +00:00

35 lines
734 B
JavaScript

import Helpers from './lib/helpers.mjs'
const tags = ['saas']
const unusedCollections = [
'collaberatorcount',
'db.subscriptions',
'projectsDeletedByMigration',
'readonlycount',
'samllog',
'sharelatex-production.docOps.2013-12-17T02-26-49.0',
'sharelatex-production.projects.2013-12-17T02-26-49.1',
'sharelatex-production.users.2013-12-17T02-26-49.2',
'sharelatex_production.users',
'totalwords',
'user',
'usersDeletedByMigration',
'usersEmailDomains',
]
const migrate = async () => {
for (const name of unusedCollections) {
await Helpers.dropCollection(name)
}
}
const rollback = async () => {
// We lost the indexes. There is no way back.
}
export default {
tags,
migrate,
rollback,
}