db-migrate-mysql
Advanced tools
Comparing version 2.0.0 to 2.1.0
62
index.js
@@ -126,10 +126,2 @@ var util = require('util'); | ||
if (spec.engine && typeof spec.engine === 'string') { | ||
constraint.push("ENGINE='" + spec.engine + "'"); | ||
} | ||
if (spec.rowFormat && typeof spec.rowFormat === 'string') { | ||
constraint.push("ROW_FORMAT='" + spec.rowFormat + "'"); | ||
} | ||
if (spec.onUpdate && spec.onUpdate.startsWith('CURRENT_TIMESTAMP')) { | ||
@@ -160,3 +152,3 @@ constraint.push('ON UPDATE ' + spec.onUpdate); | ||
if (spec.comment) { | ||
constraint.push(`COMMENT '${spec.comment}`); | ||
constraint.push(`COMMENT '${spec.comment}'`); | ||
} | ||
@@ -176,2 +168,28 @@ | ||
_applyTableOptions: function (spec, tableName) { | ||
const tableOpts = []; | ||
// if there is no columns in the options object | ||
// it means it was a default payload without table options | ||
if (!spec.columns) return ''; | ||
if (spec.engine && typeof spec.engine === 'string') { | ||
tableOpts.push(`ENGINE ${spec.engine}`); | ||
} | ||
if (spec.rowFormat && typeof spec.rowFormat === 'string') { | ||
tableOpts.push(`ROW_FORMAT ${spec.rowFormat}`); | ||
} | ||
if (spec.collate && typeof spec.collate === 'string') { | ||
tableOpts.push(`COLLATE '${spec.collate}'`); | ||
} | ||
if (spec.charset && typeof spec.charset === 'string') { | ||
tableOpts.push(`CHARACTER SET ${spec.charset}`); | ||
} | ||
return tableOpts.join(' '); | ||
}, | ||
createDatabase: function (dbName, options, callback) { | ||
@@ -267,13 +285,18 @@ var spec = ''; | ||
// So, check the args to ensure they are valid | ||
if (arguments.length === 2 && typeof indexName === 'function') { | ||
if ( | ||
arguments.length === 1 || | ||
(arguments.length === 2 && typeof indexName === 'function') | ||
) { | ||
callback = indexName; | ||
process.nextTick(function () { | ||
callback( | ||
new Error( | ||
'Illegal arguments, must provide "tableName" and "indexName"' | ||
) | ||
); | ||
}); | ||
const err = new Error( | ||
'Illegal arguments, must provide "tableName" and "indexName"' | ||
); | ||
return; | ||
if (typeof indexName === 'function') { | ||
process.nextTick(function () { | ||
callback(err); | ||
}); | ||
} | ||
return Promise.reject(err); | ||
} | ||
@@ -438,3 +461,4 @@ | ||
var sql = params.shift(); | ||
var callback = params.pop(); | ||
var callback = | ||
typeof params[params.length - 1] === 'function' ? params.pop() : null; | ||
@@ -441,0 +465,0 @@ if (params.length > 0 && Array.isArray(params[0])) { |
{ | ||
"name": "db-migrate-mysql", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "db-migrate mysql driver", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node node_modules/.bin/vows" | ||
"test": "lab -t 60" | ||
}, | ||
@@ -30,3 +30,3 @@ "repository": { | ||
"bluebird": "^3.2.1", | ||
"db-migrate-base": "^1.2.5", | ||
"db-migrate-base": "^2.1.0", | ||
"moment": "^2.11.2", | ||
@@ -36,2 +36,4 @@ "mysql": "^2.17.1" | ||
"devDependencies": { | ||
"@hapi/code": "^7.0.0", | ||
"@hapi/lab": "^21.0.0", | ||
"db-meta": "^0.4.1", | ||
@@ -44,6 +46,4 @@ "db-migrate-shared": "^1.1.2", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"lab": "^18.0.2", | ||
"vows": "0.8.0" | ||
"eslint-plugin-standard": "^4.0.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17125
9
435
+ Addeddb-migrate-base@2.3.1(transitive)
- Removeddb-migrate-base@1.6.3(transitive)
Updateddb-migrate-base@^2.1.0