Skip to content

Commit

Permalink
Merge branch 'master' into release/2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
StorytellerCZ committed Jun 4, 2023
2 parents f20a1a1 + 6a7a369 commit 458d496
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 32 deletions.
62 changes: 31 additions & 31 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
allow-deny@1.1.1
babel-compiler@7.9.0
babel-compiler@7.10.4
babel-runtime@1.5.1
base64@1.0.12
binary-heap@1.0.11
boilerplate-generator@1.7.1
callback-hook@1.4.0
check@1.3.1
ddp@1.4.0
ddp-client@2.6.0
callback-hook@1.5.1
check@1.3.2
ddp@1.4.1
ddp-client@2.6.1
ddp-common@1.4.0
ddp-server@2.6.0
diff-sequence@1.1.1
dynamic-import@0.7.2
ecmascript@0.16.2
ecmascript-runtime@0.8.0
ddp-server@2.6.1
diff-sequence@1.1.2
dynamic-import@0.7.3
ecmascript@0.16.7
ecmascript-runtime@0.8.1
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
ejson@1.1.2
fetch@0.1.1
geojson-utils@1.0.10
ejson@1.1.3
fetch@0.1.3
geojson-utils@1.0.11
id-map@1.1.1
inter-process-messaging@0.1.1
local-test:percolate:migrations@1.1.0
logging@1.3.1
meteor@1.10.1
minimongo@1.9.0
modern-browsers@0.1.8
local-test:percolate:migrations@1.1.1
logging@1.3.2
meteor@1.11.2
minimongo@1.9.3
modern-browsers@0.1.9
modules@0.19.0
modules-runtime@0.13.0
mongo@1.16.0
modules-runtime@0.13.1
mongo@1.16.6
mongo-decimal@0.1.3
mongo-dev-server@1.1.0
mongo-id@1.0.8
npm-mongo@4.9.0
npm-mongo@4.16.0
ordered-dict@1.1.0
percolate:migrations@1.1.0
promise@0.12.0
random@1.2.0
react-fast-refresh@0.2.3
percolate:migrations@1.1.1
promise@0.12.2
random@1.2.1
react-fast-refresh@0.2.7
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
socket-stream-client@0.5.0
tinytest@1.2.1
tracker@1.2.0
underscore@1.0.10
webapp@1.13.1
webapp-hashing@1.1.0
socket-stream-client@0.5.1
tinytest@1.2.2
tracker@1.3.2
underscore@1.0.13
webapp@1.13.5
webapp-hashing@1.1.1
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,30 @@ $ ./packages/percolatestudio-migrations/migrate.sh latest --settings ./setting.j
Migrations.unlock();
```
### Threading and Callbacks
The following is example code to wait for asynchronous code to complete prior to going on to next migration.
```js
Migrations.add({
version: 1,
up: Meteor.wrapAsync(async (_, next) => {
await doSomethingAsynchonously();
next();
}),
down: Meteor.wrapAsync(async (_, next) => {
await doDownAsynchronously();
next();
}),
});
```
* Note: You may want to to call migration after startup in case your host (such as Heroku) limits the amount of time given for startup
``` javascript
Meteor.startup(function() {
setTimetout("Migrations.migrateTo('latest')", 0);
});
```
## Contributing
1. Write some code.
Expand Down
3 changes: 2 additions & 1 deletion migrations_server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check, Match } from 'meteor/check';
import { Log } from 'meteor/logging';

Expand Down Expand Up @@ -72,7 +73,7 @@ function createLogger(prefix) {
check(level, Match.OneOf('info', 'error', 'warn', 'debug'));
check(message, String);

const logger = Migrations.options && Migrations.options.logger;
const logger = Migrations.options?.logger;

if (logger && typeof logger === 'function') {
logger({
Expand Down

0 comments on commit 458d496

Please sign in to comment.