Merge branch 'release/1.4.2' into production

This commit is contained in:
Raymond Feng 2014-08-15 16:30:27 -07:00
commit 5caccf5a1d
3 changed files with 13 additions and 5 deletions

View File

@ -54,6 +54,14 @@ exports.initialize = function initializeDataSource(dataSource, callback) {
options.database = s.database; options.database = s.database;
} }
// Take other options for mysql driver
// See https://github.com/strongloop/loopback-connector-mysql/issues/46
for (var p in s) {
if (options[p] === undefined) {
options[p] = s[p];
}
}
dataSource.client = mysql.createPool(options); dataSource.client = mysql.createPool(options);
dataSource.client.on('error', function (err) { dataSource.client.on('error', function (err) {
@ -1027,11 +1035,11 @@ function stringOptionsByType(p, dt) {
case 'varchar': case 'varchar':
// The maximum length for an ID column is 1000 bytes // The maximum length for an ID column is 1000 bytes
// The maximum row size is 64K // The maximum row size is 64K
var len = p.limit || ((p.type !== String) ? 8192 : p.id ? 255: 1024); var len = p.length || p.limit || ((p.type !== String) ? 4096 : p.id ? 255: 512);
dt += '(' + len + ')'; dt += '(' + len + ')';
break; break;
case 'char': case 'char':
len = p.limit || 255; len = p.length || p.limit || 255;
dt += '(' + len + ')'; dt += '(' + len + ')';
break; break;

View File

@ -1,6 +1,6 @@
{ {
"name": "loopback-connector-mysql", "name": "loopback-connector-mysql",
"version": "1.4.1", "version": "1.4.2",
"description": "MySQL connector for loopback-datasource-juggler", "description": "MySQL connector for loopback-datasource-juggler",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -26,14 +26,14 @@ describe('migrations', function () {
Extra: 'auto_increment' }, Extra: 'auto_increment' },
email: { email: {
Field: 'email', Field: 'email',
Type: 'varchar(1024)', Type: 'varchar(512)',
Null: 'NO', Null: 'NO',
Key: 'MUL', Key: 'MUL',
Default: null, Default: null,
Extra: '' }, Extra: '' },
name: { name: {
Field: 'name', Field: 'name',
Type: 'varchar(1024)', Type: 'varchar(512)',
Null: 'YES', Null: 'YES',
Key: '', Key: '',
Default: null, Default: null,