percolatestudio / meteor-migrations

Simple migration system for Meteor
https://atmospherejs.com/percolate/migrations
MIT License
245 stars 58 forks source link

Support async migration #82

Closed mjcctech closed 1 year ago

megawebmaster commented 3 years ago

There is a better way to support async migrations:

Migrations.add({
  version: 1,
  up: Meteor.wrapAsync(async (_, next) => {
    await doSomethingAsynchonously();
    next();
  }),
  down: Meteor.wrapAsync(async (_, next) => {
    await doDownAsynchronously();
    next();
  }),
});

Current implementation supports it as the solution uses built-in Meteor behavior from Fibers :muscle: I hope it helps someone.

StorytellerCZ commented 1 year ago

I'm closing this as there is a workaround provided by @megawebmaster and impending upgrade for Meteor 3.