File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -211,13 +211,14 @@ module.exports = {
211
211
//
212
212
// Remember: connection string takes priority over `meta` in the event of a conflict.
213
213
try {
214
- var parsedConnectionStr = Url . parse ( inputs . connectionString ) ;
215
-
216
- // Validate that a protocol was found before other pieces
217
- // (otherwise other parsed info will be very weird and wrong)
218
- if ( ! parsedConnectionStr . protocol || parsedConnectionStr . protocol !== 'mysql:' ) {
219
- throw new Error ( 'Protocol (i.e. ` mysql://`) is required in connection string.' ) ;
214
+ var urlToParse = inputs . connectionString ;
215
+ // We don't actually care about the protocol, but `url.parse()` returns funky results
216
+ // if the argument doesn't have one. So we'll add one if necessary.
217
+ // See https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax
218
+ if ( ! urlToParse . match ( / ^ [ a - z A - Z ] [ a - z A - Z 0 - 9 + . - ] * : \/ \/ / ) ) {
219
+ urlToParse = ' mysql://' + urlToParse ;
220
220
}
221
+ var parsedConnectionStr = Url . parse ( urlToParse ) ;
221
222
222
223
// Parse port & host
223
224
var DEFAULT_HOST = 'localhost' ;
You can’t perform that action at this time.
0 commit comments