Skip to content

Commit

Permalink
Merge pull request #5321 from luin/fix-uppercase-enum
Browse files Browse the repository at this point in the history
fix: describe query should not uppercase the enum type
  • Loading branch information
janmeier committed Feb 15, 2016
2 parents d220186 + 09893b3 commit b48f065
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/dialects/mysql/query.js
Expand Up @@ -91,8 +91,9 @@ Query.prototype.formatResults = function(data) {
result = {};

data.forEach(function(_result) {
var enumRegex = /^enum/i;
result[_result.Field] = {
type: _result.Type.toUpperCase(),
type: enumRegex.test(_result.Type) ? _result.Type.replace(enumRegex, 'ENUM') : _result.Type.toUpperCase(),
allowNull: (_result.Null === 'YES'),
defaultValue: _result.Default,
primaryKey: _result.Key === 'PRI'
Expand Down
2 changes: 2 additions & 0 deletions test/integration/query-interface.test.js
Expand Up @@ -194,6 +194,8 @@ describe(Support.getTestDialectTeaser('QueryInterface'), function() {
if (dialect === 'postgres' || dialect === 'postgres-native') {
expect(enumVals.special).to.be.instanceof(Array);
expect(enumVals.special).to.have.length(2);
} else if (dialect === 'mysql') {
expect(enumVals.type).to.eql('ENUM(\'hello\',\'world\')');
}
});
});
Expand Down

0 comments on commit b48f065

Please sign in to comment.