Merge branch 'release/1.5.1' into production
This commit is contained in:
commit
7cb6efe454
18
CHANGES.md
18
CHANGES.md
|
@ -1,3 +1,21 @@
|
||||||
|
2015-01-15, Version 1.5.1
|
||||||
|
=========================
|
||||||
|
|
||||||
|
* Fix the loop of models (Raymond Feng)
|
||||||
|
|
||||||
|
* Set ok default to false (Geoffroy Lesage)
|
||||||
|
|
||||||
|
* Fixed missing 'ok' (Geoffroy Lesage)
|
||||||
|
|
||||||
|
* Changed default type mapping (Geoffroy Lesage)
|
||||||
|
|
||||||
|
* Fixed isActual syntax to accept optional model arg (Geoffroy Lesage)
|
||||||
|
|
||||||
|
* Fixed isActual implemenation (Geoffroy Lesage)
|
||||||
|
|
||||||
|
* Inherit Schema From DataSource if not defined (Serkan Serttop)
|
||||||
|
|
||||||
|
|
||||||
2015-01-09, Version 1.5.0
|
2015-01-09, Version 1.5.0
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,9 @@ function mixinDiscovery(MySQL) {
|
||||||
MySQL.prototype.discoverModelProperties = function (table, options, cb) {
|
MySQL.prototype.discoverModelProperties = function (table, options, cb) {
|
||||||
var args = getArgs(table, options, cb);
|
var args = getArgs(table, options, cb);
|
||||||
var owner = args.owner;
|
var owner = args.owner;
|
||||||
|
if(!owner){
|
||||||
|
owner = inheritOwnerViaDataSource.call(this);
|
||||||
|
}
|
||||||
table = args.table;
|
table = args.table;
|
||||||
options = args.options;
|
options = args.options;
|
||||||
cb = args.cb;
|
cb = args.cb;
|
||||||
|
@ -228,6 +231,9 @@ function mixinDiscovery(MySQL) {
|
||||||
MySQL.prototype.discoverPrimaryKeys = function (table, options, cb) {
|
MySQL.prototype.discoverPrimaryKeys = function (table, options, cb) {
|
||||||
var args = getArgs(table, options, cb);
|
var args = getArgs(table, options, cb);
|
||||||
var owner = args.owner;
|
var owner = args.owner;
|
||||||
|
if(!owner){
|
||||||
|
owner = inheritOwnerViaDataSource.call(this);
|
||||||
|
}
|
||||||
table = args.table;
|
table = args.table;
|
||||||
options = args.options;
|
options = args.options;
|
||||||
cb = args.cb;
|
cb = args.cb;
|
||||||
|
@ -269,6 +275,9 @@ function mixinDiscovery(MySQL) {
|
||||||
MySQL.prototype.discoverForeignKeys = function (table, options, cb) {
|
MySQL.prototype.discoverForeignKeys = function (table, options, cb) {
|
||||||
var args = getArgs(table, options, cb);
|
var args = getArgs(table, options, cb);
|
||||||
var owner = args.owner;
|
var owner = args.owner;
|
||||||
|
if(!owner){
|
||||||
|
owner = inheritOwnerViaDataSource.call(this);
|
||||||
|
}
|
||||||
table = args.table;
|
table = args.table;
|
||||||
options = args.options;
|
options = args.options;
|
||||||
cb = args.cb;
|
cb = args.cb;
|
||||||
|
@ -312,6 +321,9 @@ function mixinDiscovery(MySQL) {
|
||||||
MySQL.prototype.discoverExportedForeignKeys = function (table, options, cb) {
|
MySQL.prototype.discoverExportedForeignKeys = function (table, options, cb) {
|
||||||
var args = getArgs(table, options, cb);
|
var args = getArgs(table, options, cb);
|
||||||
var owner = args.owner;
|
var owner = args.owner;
|
||||||
|
if(!owner){
|
||||||
|
owner = inheritOwnerViaDataSource.call(this);
|
||||||
|
}
|
||||||
table = args.table;
|
table = args.table;
|
||||||
options = args.options;
|
options = args.options;
|
||||||
cb = args.cb;
|
cb = args.cb;
|
||||||
|
@ -366,4 +378,11 @@ function mixinDiscovery(MySQL) {
|
||||||
return 'String';
|
return 'String';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function inheritOwnerViaDataSource(){
|
||||||
|
if(this.dataSource && this.dataSource.settings && this.dataSource.settings.database){
|
||||||
|
return this.dataSource.settings.database;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
24
lib/mysql.js
24
lib/mysql.js
|
@ -690,10 +690,22 @@ MySQL.prototype.createTable = function (model, cb) {
|
||||||
* @param {String[]} [models] A model name or an array of model names. If not present, apply to all models
|
* @param {String[]} [models] A model name or an array of model names. If not present, apply to all models
|
||||||
* @param {Function} [cb] The callback function
|
* @param {Function} [cb] The callback function
|
||||||
*/
|
*/
|
||||||
MySQL.prototype.isActual = function(cb) {
|
MySQL.prototype.isActual = function(models, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var ok = false;
|
var ok = false;
|
||||||
async.each(Object.keys(this._models), function(model, done) {
|
|
||||||
|
if ((!cb) && ('function' === typeof models)) {
|
||||||
|
cb = models;
|
||||||
|
models = undefined;
|
||||||
|
}
|
||||||
|
// First argument is a model name
|
||||||
|
if ('string' === typeof models) {
|
||||||
|
models = [models];
|
||||||
|
}
|
||||||
|
|
||||||
|
models = models || Object.keys(this._models);
|
||||||
|
|
||||||
|
async.each(models, function(model, done) {
|
||||||
var table = self.tableEscaped(model);
|
var table = self.tableEscaped(model);
|
||||||
self.query('SHOW FIELDS FROM ' + table, function(err, fields) {
|
self.query('SHOW FIELDS FROM ' + table, function(err, fields) {
|
||||||
self.query('SHOW INDEXES FROM ' + table, function(err, indexes) {
|
self.query('SHOW INDEXES FROM ' + table, function(err, indexes) {
|
||||||
|
@ -1025,10 +1037,6 @@ function datatype(p) {
|
||||||
var dt = '';
|
var dt = '';
|
||||||
switch (p.type.name) {
|
switch (p.type.name) {
|
||||||
default:
|
default:
|
||||||
case 'String':
|
|
||||||
dt = columnType(p, 'VARCHAR');
|
|
||||||
dt = stringOptionsByType(p, dt);
|
|
||||||
break;
|
|
||||||
case 'JSON':
|
case 'JSON':
|
||||||
case 'Object':
|
case 'Object':
|
||||||
case 'Any':
|
case 'Any':
|
||||||
|
@ -1036,6 +1044,10 @@ function datatype(p) {
|
||||||
dt = columnType(p, 'TEXT');
|
dt = columnType(p, 'TEXT');
|
||||||
dt = stringOptionsByType(p, dt);
|
dt = stringOptionsByType(p, dt);
|
||||||
break;
|
break;
|
||||||
|
case 'String':
|
||||||
|
dt = columnType(p, 'VARCHAR');
|
||||||
|
dt = stringOptionsByType(p, dt);
|
||||||
|
break;
|
||||||
case 'Number':
|
case 'Number':
|
||||||
dt = columnType(p, 'INT');
|
dt = columnType(p, 'INT');
|
||||||
dt = numericOptionsByType(p, dt);
|
dt = numericOptionsByType(p, dt);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "loopback-connector-mysql",
|
"name": "loopback-connector-mysql",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"description": "MySQL connector for loopback-datasource-juggler",
|
"description": "MySQL connector for loopback-datasource-juggler",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -27,6 +27,6 @@
|
||||||
"url": "https://github.com/strongloop/loopback-connector-mysql/blob/master/LICENSE"
|
"url": "https://github.com/strongloop/loopback-connector-mysql/blob/master/LICENSE"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"sl-blip": "http://blip.strongloop.com/loopback-connector-mysql@1.5.0"
|
"sl-blip": "http://blip.strongloop.com/loopback-connector-mysql@1.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue