20200110183327_brandVarationIdIndex.js 488 B

123456789101112131415161718192021222324
  1. const Helpers = require('./lib/helpers')
  2. exports.tags = ['saas']
  3. const indexes = [
  4. {
  5. key: {
  6. brandVariationId: 1,
  7. },
  8. name: 'brandVariationId_1',
  9. },
  10. ]
  11. exports.migrate = async ({ db }) => {
  12. await Helpers.addIndexesToCollection(db.projects, indexes)
  13. }
  14. exports.rollback = async ({ db }) => {
  15. try {
  16. await Helpers.dropIndexesFromCollection(db.projects, indexes)
  17. } catch (err) {
  18. console.error('Something went wrong rolling back the migrations', err)
  19. }
  20. }