@@ -107,35 +107,40 @@ Walker.prototype = {
107
107
up : function ( options , callback ) {
108
108
const partialName = options . destination ;
109
109
const count = options . count ;
110
- return Promise . all ( [
110
+ const files = Promise . all ( [
111
111
File . loadFromFileystem ( this . directory , this . prefix , this . internals ) ,
112
112
File . loadFromDatabase (
113
113
this . directory ,
114
114
this . prefix ,
115
115
this . _driver ,
116
116
this . internals
117
117
)
118
- ] )
119
- . spread ( ( allFiles , completedFiles ) => {
120
- const toRun = dbmUtil . filterUp (
121
- allFiles ,
122
- completedFiles ,
123
- partialName ,
124
- count
125
- ) ;
118
+ ] ) . spread ( ( allFiles , completedFiles ) => {
119
+ const toRun = dbmUtil . filterUp (
120
+ allFiles ,
121
+ completedFiles ,
122
+ partialName ,
123
+ count
124
+ ) ;
125
+
126
+ if ( toRun . length === 0 ) {
127
+ log . info ( this . title + 'Nothing to run' ) ;
128
+ }
126
129
127
- if ( toRun . length === 0 ) {
128
- log . info ( this . title + 'Nothing to run' ) ;
129
- }
130
+ if ( this . internals . check ) {
131
+ const toRunNames = toRun . map ( migration => migration . name ) ;
132
+ log . info ( this . title + 'run:' , toRunNames ) ;
133
+ return toRunNames ;
134
+ }
130
135
131
- if ( this . internals . check ) {
132
- const toRunNames = toRun . map ( migration => migration . name ) ;
133
- log . info ( this . title + 'run:' , toRunNames ) ;
134
- return [ ] ;
135
- }
136
+ return toRun ;
137
+ } ) ;
136
138
137
- return toRun ;
138
- } )
139
+ if ( this . internals . check ) {
140
+ return files . nodeify ( callback ) ;
141
+ }
142
+
143
+ return files
139
144
. each ( file => {
140
145
log . verbose ( this . title + 'preparing to run up:' , file . name ) ;
141
146
const _meta = file . get ( ) . _meta || { } ;
@@ -153,27 +158,32 @@ Walker.prototype = {
153
158
const partialName = options . destination ;
154
159
const count = options . count ;
155
160
156
- return File . loadFromDatabase (
161
+ const files = File . loadFromDatabase (
157
162
this . directory ,
158
163
this . prefix ,
159
164
this . _driver ,
160
165
this . internals
161
- )
162
- . then ( completedFiles => {
163
- const toRun = dbmUtil . filterDown ( completedFiles , partialName , count ) ;
166
+ ) . then ( completedFiles => {
167
+ const toRun = dbmUtil . filterDown ( completedFiles , partialName , count ) ;
164
168
165
- if ( toRun . length === 0 ) {
166
- log . info ( this . title + 'Nothing to run' ) ;
167
- }
169
+ if ( toRun . length === 0 ) {
170
+ log . info ( this . title + 'Nothing to run' ) ;
171
+ }
168
172
169
- if ( this . internals . check ) {
170
- const toRunNames = toRun . map ( migration => migration . name ) ;
171
- log . info ( this . title + 'To run:' , toRunNames ) ;
172
- return [ ] ;
173
- }
173
+ if ( this . internals . check ) {
174
+ const toRunNames = toRun . map ( migration => migration . name ) ;
175
+ log . info ( this . title + 'run:' , toRunNames ) ;
176
+ return toRunNames ;
177
+ }
174
178
175
- return toRun ;
176
- } )
179
+ return toRun ;
180
+ } ) ;
181
+
182
+ if ( this . internals . check ) {
183
+ return files . nodeify ( callback ) ;
184
+ }
185
+
186
+ return files
177
187
. each ( file => {
178
188
log . verbose ( this . title + 'preparing to run down:' , file . name ) ;
179
189
const _meta = file . get ( ) . _meta || { } ;
0 commit comments