diff --git a/services/web/migrations/20250116090000_onboardingDataCollection_updatedAt_index.mjs b/services/web/migrations/20250116090000_onboardingDataCollection_updatedAt_index.mjs new file mode 100644 index 0000000000..a22b2b39fd --- /dev/null +++ b/services/web/migrations/20250116090000_onboardingDataCollection_updatedAt_index.mjs @@ -0,0 +1,30 @@ +import Helpers from './lib/helpers.mjs' + +const tags = ['saas'] + +const index = { + key: { updatedAt: 1 }, + name: 'updatedAt_1', +} + +const migrate = async client => { + const { db } = client + await Helpers.addIndexesToCollection(db.onboardingDataCollection, [index]) +} + +const rollback = async client => { + const { db } = client + try { + await Helpers.dropIndexesFromCollection(db.onboardingDataCollection, [ + index, + ]) + } catch (err) { + console.error('Something went wrong rolling back the migrations', err) + } +} + +export default { + tags, + migrate, + rollback, +}