20190912145006_create_docOps_indexes.mjs 596 B

123456789101112131415161718192021222324252627282930
  1. import Helpers from './lib/helpers.mjs'
  2. import { getCollectionInternal } from './lib/mongodb.mjs'
  3. const tags = ['server-ce', 'server-pro', 'saas']
  4. const indexes = [
  5. {
  6. unique: true,
  7. key: {
  8. doc_id: 1,
  9. },
  10. name: 'doc_id_1',
  11. },
  12. ]
  13. const migrate = async () => {
  14. const docOps = await getCollectionInternal('docOps')
  15. await Helpers.addIndexesToCollection(docOps, indexes)
  16. }
  17. const rollback = async () => {
  18. const docOps = await getCollectionInternal('docOps')
  19. await Helpers.dropIndexesFromCollection(docOps, indexes)
  20. }
  21. export default {
  22. tags,
  23. migrate,
  24. rollback,
  25. }