不要怂,就是干,撸起袖子干!

Commit 09893b3c by Zihua Li Committed by luin

fix(mysql): describe query should not uppercase the enum type

1 parent 1182a4a1
...@@ -91,8 +91,9 @@ Query.prototype.formatResults = function(data) { ...@@ -91,8 +91,9 @@ Query.prototype.formatResults = function(data) {
result = {}; result = {};
data.forEach(function(_result) { data.forEach(function(_result) {
var enumRegex = /^enum/i;
result[_result.Field] = { result[_result.Field] = {
type: _result.Type.toUpperCase(), type: enumRegex.test(_result.Type) ? _result.Type.replace(enumRegex, 'ENUM') : _result.Type.toUpperCase(),
allowNull: (_result.Null === 'YES'), allowNull: (_result.Null === 'YES'),
defaultValue: _result.Default, defaultValue: _result.Default,
primaryKey: _result.Key === 'PRI' primaryKey: _result.Key === 'PRI'
......
...@@ -194,6 +194,8 @@ describe(Support.getTestDialectTeaser('QueryInterface'), function() { ...@@ -194,6 +194,8 @@ describe(Support.getTestDialectTeaser('QueryInterface'), function() {
if (dialect === 'postgres' || dialect === 'postgres-native') { if (dialect === 'postgres' || dialect === 'postgres-native') {
expect(enumVals.special).to.be.instanceof(Array); expect(enumVals.special).to.be.instanceof(Array);
expect(enumVals.special).to.have.length(2); expect(enumVals.special).to.have.length(2);
} else if (dialect === 'mysql') {
expect(enumVals.type).to.eql('ENUM(\'hello\',\'world\')');
} }
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!