20200110183327_brandVarationIdIndex.mjs 532 B

123456789101112131415161718192021222324252627282930
  1. import Helpers from './lib/helpers.mjs'
  2. const tags = ['saas']
  3. const indexes = [
  4. {
  5. key: {
  6. brandVariationId: 1,
  7. },
  8. name: 'brandVariationId_1',
  9. },
  10. ]
  11. const migrate = async ({ db }) => {
  12. await Helpers.addIndexesToCollection(db.projects, indexes)
  13. }
  14. const 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. }
  21. export default {
  22. tags,
  23. migrate,
  24. rollback,
  25. }