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