Merge branch 'release/1.1.1' into production

This commit is contained in:
Raymond Feng 2013-12-06 10:37:20 -08:00
commit c221713aad
3 changed files with 34 additions and 8 deletions

View File

@ -31,9 +31,7 @@ exports.initialize = function initializeDataSource(dataSource, callback) {
s.supportBigNumbers = (s.supportBigNumbers || false);
s.timezone = (s.timezone || 'local');
if(isNaN(s.connectionLimit)) {
s.connectionLimit = s.connectionLimit;
} else {
if(!isNaN(s.connectionLimit)) {
s.connectionLimit = 10;
}
@ -473,7 +471,7 @@ MySQL.prototype.all = function all(model, filter, callback) {
if (!filter.order) {
var idNames = this.idNames(model);
if (idNames && idNames.length) {
filter.order = idNames.join(' ');
filter.order = idNames;
}
}

View File

@ -1,20 +1,22 @@
{
"name": "loopback-connector-mysql",
"version": "1.1.0",
"version": "1.1.1",
"description": "MySQL connector for loopback-datasource-juggler",
"main": "index.js",
"scripts": {
"test": "make test"
},
"dependencies": {
"loopback-datasource-juggler": "1.x.x",
"mysql": "~2.0.0-alpha9",
"mysql": "~2.0.0-rc2",
"async": "~0.2.9"
},
"devDependencies": {
"loopback-datasource-juggler": "1.x.x"
},
"devDependencies": {
"loopback-datasource-juggler": "1.x.x",
"should": "~1.3.0",
"mocha": "~1.14.0",
"blanket": "~1.1.5",
"rc": "~0.3.1"
},
"repository": {

View File

@ -7,6 +7,7 @@ var db;
before(function() {
var config = require('rc')('loopback', {dev: {mysql: {}}}).dev.mysql;
config.database = 'STRONGLOOP';
db = new DataSource(require('../'), config);
});
@ -192,3 +193,28 @@ describe('Discover LDL schema from a table', function () {
});
});
});
describe('Discover and build models', function () {
it('should discover and build models', function (done) {
db.discoverAndBuildModels('INVENTORY', {owner: 'STRONGLOOP', visited: {}, associations: true}, function (err, models) {
assert(models.Inventory, 'Inventory model should be discovered and built');
var schema = models.Inventory.definition;
assert(schema.settings.mysql.schema === 'STRONGLOOP');
assert(schema.settings.mysql.table === 'INVENTORY');
assert(schema.properties.productId);
assert(schema.properties.productId.type === String);
assert(schema.properties.productId.mysql.columnName === 'PRODUCT_ID');
assert(schema.properties.locationId);
assert(schema.properties.locationId.type === String);
assert(schema.properties.locationId.mysql.columnName === 'LOCATION_ID');
assert(schema.properties.available);
assert(schema.properties.available.type === Number);
assert(schema.properties.total);
assert(schema.properties.total.type === Number);
models.Inventory.findOne(function (err, inv) {
assert(!err, 'error should not be reported');
done();
});
});
});
});