@@ -32,23 +32,39 @@ describe('migration', function () {
32
32
}
33
33
} )
34
34
35
- it . skip ( 'should migrate to previous version and back again' , async function ( ) {
35
+ it ( 'should migrate to previous version and back again' , async function ( ) {
36
36
const { contractor } = this . test
37
37
38
38
await contractor . create ( )
39
39
40
40
await contractor . rollback ( currentSchemaVersion )
41
- const oldVersion = await contractor . version ( )
41
+ const oldVersion = await contractor . schemaVersion ( )
42
42
43
43
assert . notStrictEqual ( oldVersion , currentSchemaVersion )
44
44
45
45
await contractor . migrate ( oldVersion )
46
- const newVersion = await contractor . version ( )
46
+ const newVersion = await contractor . schemaVersion ( )
47
47
48
48
assert . strictEqual ( newVersion , currentSchemaVersion )
49
49
} )
50
50
51
- it . skip ( 'should migrate to latest during start if on previous schema version' , async function ( ) {
51
+ it ( 'should install next version via contractor' , async function ( ) {
52
+ const { contractor } = this . test
53
+
54
+ await contractor . create ( )
55
+
56
+ await contractor . rollback ( currentSchemaVersion )
57
+
58
+ const oneVersionAgo = await contractor . schemaVersion ( )
59
+
60
+ await contractor . next ( oneVersionAgo )
61
+
62
+ const version = await contractor . schemaVersion ( )
63
+
64
+ assert . strictEqual ( version , currentSchemaVersion )
65
+ } )
66
+
67
+ it ( 'should migrate to latest during start if on previous schema version' , async function ( ) {
52
68
const { contractor } = this . test
53
69
54
70
await contractor . create ( )
@@ -61,7 +77,7 @@ describe('migration', function () {
61
77
62
78
await boss . start ( )
63
79
64
- const version = await contractor . version ( )
80
+ const version = await contractor . schemaVersion ( )
65
81
66
82
assert . strictEqual ( version , currentSchemaVersion )
67
83
} )
@@ -88,22 +104,22 @@ describe('migration', function () {
88
104
await boss . send ( queue )
89
105
90
106
await contractor . rollback ( currentSchemaVersion )
91
- const oneVersionAgo = await contractor . version ( )
107
+ const oneVersionAgo = await contractor . schemaVersion ( )
92
108
93
109
assert . notStrictEqual ( oneVersionAgo , currentSchemaVersion )
94
110
95
111
await contractor . rollback ( oneVersionAgo )
96
- const twoVersionsAgo = await contractor . version ( )
112
+ const twoVersionsAgo = await contractor . schemaVersion ( )
97
113
98
114
assert . notStrictEqual ( twoVersionsAgo , oneVersionAgo )
99
115
100
116
await contractor . next ( twoVersionsAgo )
101
- const oneVersionAgoPart2 = await contractor . version ( )
117
+ const oneVersionAgoPart2 = await contractor . schemaVersion ( )
102
118
103
119
assert . strictEqual ( oneVersionAgo , oneVersionAgoPart2 )
104
120
105
121
await contractor . next ( oneVersionAgo )
106
- const version = await contractor . version ( )
122
+ const version = await contractor . schemaVersion ( )
107
123
108
124
assert . strictEqual ( version , currentSchemaVersion )
109
125
@@ -118,18 +134,18 @@ describe('migration', function () {
118
134
await contractor . create ( )
119
135
120
136
await contractor . rollback ( currentSchemaVersion )
121
- const oneVersionAgo = await contractor . version ( )
137
+ const oneVersionAgo = await contractor . schemaVersion ( )
122
138
assert . strictEqual ( oneVersionAgo , currentSchemaVersion - 1 )
123
139
124
140
await contractor . rollback ( oneVersionAgo )
125
- const twoVersionsAgo = await contractor . version ( )
141
+ const twoVersionsAgo = await contractor . schemaVersion ( )
126
142
assert . strictEqual ( twoVersionsAgo , currentSchemaVersion - 2 )
127
143
128
144
const config = { ...this . test . bossConfig }
129
145
const boss = this . test . boss = new PgBoss ( config )
130
146
await boss . start ( )
131
147
132
- const version = await contractor . version ( )
148
+ const version = await contractor . schemaVersion ( )
133
149
134
150
assert . strictEqual ( version , currentSchemaVersion )
135
151
} )
@@ -146,7 +162,7 @@ describe('migration', function () {
146
162
}
147
163
} )
148
164
149
- it . skip ( 'should roll back an error during a migration' , async function ( ) {
165
+ it ( 'should roll back an error during a migration' , async function ( ) {
150
166
const { contractor } = this . test
151
167
152
168
const config = { ...this . test . bossConfig }
@@ -158,7 +174,7 @@ describe('migration', function () {
158
174
159
175
await contractor . create ( )
160
176
await contractor . rollback ( currentSchemaVersion )
161
- const oneVersionAgo = await contractor . version ( )
177
+ const oneVersionAgo = await contractor . schemaVersion ( )
162
178
163
179
const boss1 = new PgBoss ( config )
164
180
@@ -170,7 +186,7 @@ describe('migration', function () {
170
186
await boss1 . stop ( { graceful : false , wait : false } )
171
187
}
172
188
173
- const version1 = await contractor . version ( )
189
+ const version1 = await contractor . schemaVersion ( )
174
190
175
191
assert . strictEqual ( version1 , oneVersionAgo )
176
192
@@ -181,7 +197,7 @@ describe('migration', function () {
181
197
182
198
await boss2 . start ( )
183
199
184
- const version2 = await contractor . version ( )
200
+ const version2 = await contractor . schemaVersion ( )
185
201
186
202
assert . strictEqual ( version2 , currentSchemaVersion )
187
203
@@ -199,7 +215,7 @@ describe('migration', function () {
199
215
}
200
216
} )
201
217
202
- it . skip ( 'should not migrate if migrate option is false' , async function ( ) {
218
+ it ( 'should not migrate if migrate option is false' , async function ( ) {
203
219
const { contractor } = this . test
204
220
205
221
await contractor . create ( )
0 commit comments