20250116090000_onboardingDataCollection_updatedAt_index.mjs 581 B

123456789101112131415161718192021222324252627282930
  1. import Helpers from './lib/helpers.mjs'
  2. const tags = ['saas']
  3. const index = {
  4. key: { updatedAt: 1 },
  5. name: 'updatedAt_1',
  6. }
  7. const migrate = async client => {
  8. const { db } = client
  9. await Helpers.addIndexesToCollection(db.onboardingDataCollection, [index])
  10. }
  11. const rollback = async client => {
  12. const { db } = client
  13. try {
  14. await Helpers.dropIndexesFromCollection(db.onboardingDataCollection, [
  15. index,
  16. ])
  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. }