20200302143624_users_affiliationUnchecked_index.js 491 B

12345678910111213141516171819202122232425
  1. /* eslint-disable no-unused-vars */
  2. exports.tags = ['saas']
  3. const Helpers = require('./lib/helpers')
  4. const indexes = [
  5. {
  6. key: {
  7. 'emails.affiliationUnchecked': 1,
  8. },
  9. name: 'affiliationUnchecked_1',
  10. sparse: true,
  11. },
  12. ]
  13. exports.migrate = async client => {
  14. const { db } = client
  15. await Helpers.addIndexesToCollection(db.users, indexes)
  16. }
  17. exports.rollback = async client => {
  18. const { db } = client
  19. await Helpers.dropIndexesFromCollection(db.users, indexes)
  20. }