@@ -68,6 +68,11 @@ module.exports = sails => {
68
68
for ( connectionName in datastores ) {
69
69
connection = datastores [ connectionName ] ;
70
70
71
+ // Skip waterline connections
72
+ if ( connection . adapter ) {
73
+ continue ;
74
+ }
75
+
71
76
if ( ! connection . options ) {
72
77
connection . options = { } ;
73
78
}
@@ -107,10 +112,14 @@ module.exports = sails => {
107
112
108
113
for ( modelName in models ) {
109
114
modelDef = models [ modelName ] ;
110
- sails . log . verbose ( 'Loading model \'' + modelDef . globalId + '\'' ) ;
111
115
112
- connectionName = modelDef . options . connection || modelDef . datastore || defaultConnection ;
116
+ // Skip models without options provided (possible Waterline models)
117
+ if ( ! modelDef . options ) {
118
+ continue ;
119
+ }
113
120
121
+ sails . log . verbose ( 'Loading model \'' + modelDef . globalId + '\'' ) ;
122
+ connectionName = modelDef . connection || modelDef . datastore || defaultConnection ;
114
123
modelClass = connections [ connectionName ] . define ( modelDef . globalId , modelDef . attributes , modelDef . options ) ;
115
124
116
125
if ( sequelizeMajVersion >= 4 ) {
@@ -132,6 +141,12 @@ module.exports = sails => {
132
141
133
142
for ( modelName in models ) {
134
143
modelDef = models [ modelName ] ;
144
+
145
+ // Skip models without options provided (possible Waterline models)
146
+ if ( ! modelDef . options ) {
147
+ continue ;
148
+ }
149
+
135
150
this . setAssociation ( modelDef ) ;
136
151
this . setDefaultScope ( modelDef , sails . models [ modelDef . globalId . toLowerCase ( ) ] ) ;
137
152
}
@@ -176,6 +191,11 @@ module.exports = sails => {
176
191
for ( connectionName in datastores ) {
177
192
connectionDescription = datastores [ connectionName ] ;
178
193
194
+ // Skip waterline connections
195
+ if ( connectionDescription . adapter ) {
196
+ continue ;
197
+ }
198
+
179
199
sails . log . verbose ( 'Migrating schema in \'' + connectionName + '\' connection' ) ;
180
200
181
201
if ( connectionDescription . dialect === 'postgres' ) {
@@ -199,9 +219,10 @@ module.exports = sails => {
199
219
} else {
200
220
syncTasks . push ( connections [ connectionName ] . sync ( { force : forceSync } ) ) ;
201
221
}
202
-
203
- Promise . all ( syncTasks ) . then ( ( ) => next ( ) ) . catch ( e => next ( e ) ) ;
204
222
}
223
+
224
+ Promise . all ( syncTasks ) . then ( ( ) => next ( ) ) . catch ( e => next ( e ) ) ;
225
+
205
226
}
206
227
}
207
228
} ;
0 commit comments