Fix the varchar length
This commit is contained in:
parent
a41c7f5c7a
commit
b9e4b64848
|
@ -973,7 +973,8 @@ function stringOptionsByType(p, dt) {
|
|||
switch (dt.toLowerCase()) {
|
||||
default:
|
||||
case 'varchar':
|
||||
var len = p.limit || ((p.type !== String) ? 32768 : 1024);
|
||||
// The maximum length for an ID column is 1000 bytes
|
||||
var len = p.limit || ((p.type !== String) ? 32768 : p.id ? 255: 1024);
|
||||
dt += '(' + len + ')';
|
||||
break;
|
||||
case 'char':
|
||||
|
|
|
@ -26,14 +26,14 @@ describe('migrations', function () {
|
|||
Extra: 'auto_increment' },
|
||||
email: {
|
||||
Field: 'email',
|
||||
Type: 'varchar(255)',
|
||||
Type: 'varchar(1024)',
|
||||
Null: 'NO',
|
||||
Key: 'MUL',
|
||||
Default: null,
|
||||
Extra: '' },
|
||||
name: {
|
||||
Field: 'name',
|
||||
Type: 'varchar(255)',
|
||||
Type: 'varchar(1024)',
|
||||
Null: 'YES',
|
||||
Key: '',
|
||||
Default: null,
|
||||
|
@ -74,7 +74,6 @@ describe('migrations', function () {
|
|||
it('UserData should have correct indexes', function (done) {
|
||||
// Note: getIndexes truncates multi-key indexes to the first member. Hence index1 is correct.
|
||||
getIndexes('UserData', function (err, fields) {
|
||||
// console.log('....', fields);
|
||||
assert.deepEqual(fields, { PRIMARY: { Table: 'UserData',
|
||||
Non_unique: 0,
|
||||
Key_name: 'PRIMARY',
|
||||
|
@ -94,7 +93,7 @@ describe('migrations', function () {
|
|||
Column_name: 'email',
|
||||
Collation: 'A',
|
||||
Cardinality: null,
|
||||
Sub_part: null,
|
||||
Sub_part: 333,
|
||||
Packed: null,
|
||||
Null: '',
|
||||
Index_type: 'BTREE',
|
||||
|
@ -106,7 +105,7 @@ describe('migrations', function () {
|
|||
Column_name: 'email',
|
||||
Collation: 'A',
|
||||
Cardinality: null,
|
||||
Sub_part: null,
|
||||
Sub_part: 333,
|
||||
Packed: null,
|
||||
Null: '',
|
||||
Index_type: 'BTREE',
|
||||
|
|
Loading…
Reference in New Issue