20251103164405_institutions_managerIds_index.mjs 574 B

12345678910111213141516171819202122232425262728293031323334
  1. import Helpers from './lib/helpers.mjs'
  2. const tags = ['saas']
  3. const indexes = [
  4. {
  5. key: {
  6. managerIds: 1,
  7. },
  8. name: 'managerIds_1',
  9. },
  10. ]
  11. const migrate = async client => {
  12. const { db } = client
  13. await Helpers.addIndexesToCollection(db.institutions, indexes)
  14. }
  15. const rollback = async client => {
  16. const { db } = client
  17. try {
  18. await Helpers.dropIndexesFromCollection(db.institutions, indexes)
  19. } catch (err) {
  20. console.error('Something went wrong rolling back the migrations', err)
  21. }
  22. }
  23. export default {
  24. tags,
  25. migrate,
  26. rollback,
  27. }