Skip to content

Commit 1fb7b25

Browse files
authored
Merge pull request #91 from meteor/migrations-2.0.1
Contribution: Run async migrations in order
2 parents 57e6b08 + b788408 commit 1fb7b25

File tree

9 files changed

+357
-1042
lines changed

9 files changed

+357
-1042
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Test
2-
on: push
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
37

48
jobs:
59
test:
@@ -9,6 +13,7 @@ jobs:
913
meteorRelease:
1014
- '--release 2.9.1'
1115
- '--release 3.0.1'
16+
- '--release 3.2.2'
1217
# Latest recommended version
1318
- ''
1419
steps:

.travis.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.versions

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,51 @@
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22-
23-
24-
local-test:percolate:[email protected]
25-
26-
27-
28-
29-
30-
31-
32-
33-
34-
35-
36-
37-
38-
39-
40-
41-
42-
43-
44-
45-
46-
47-
48-
49-
1+
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
local-test:percolate:[email protected]
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,22 @@ Migrations.add({
205205
});
206206
```
207207
208-
For Meteor 2.8+ you can pass async function directly.
208+
Starting from Meteor 2.8+, you can use async functions directly in your migrations:
209+
210+
```js
211+
Migrations.add({
212+
version: 3,
213+
name: 'Add belts to people wearing pants.',
214+
up: async function () {
215+
// Asynchronous migration code
216+
await SomeCollection.updateAsync({ wearsPants: true }, { $set: { hasBelt: true } }, { multi: true });
217+
},
218+
down: async function () {
219+
// Asynchronous rollback code
220+
await SomeCollection.updateAsync({}, { $unset: { hasBelt: true } }, { multi: true });
221+
},
222+
});
223+
```
209224
210225
* Note: You may want to call migration after startup in case your host (such as Heroku) limits the amount of time given for startup
211226
``` javascript

0 commit comments

Comments
 (0)