20200302143624_users_affiliationUnchecked_index.mjs 535 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: {
  7. 'emails.affiliationUnchecked': 1,
  8. },
  9. name: 'affiliationUnchecked_1',
  10. sparse: true,
  11. },
  12. ]
  13. const migrate = async client => {
  14. const { db } = client
  15. await Helpers.addIndexesToCollection(db.users, indexes)
  16. }
  17. const rollback = async client => {
  18. const { db } = client
  19. await Helpers.dropIndexesFromCollection(db.users, indexes)
  20. }
  21. export default {
  22. tags,
  23. migrate,
  24. rollback,
  25. }