Merge pull request #306 from strongloop/decimal-number

Add DECIMAL to Number prop type
This commit is contained in:
Tetsuo Seto 2017-06-27 12:06:25 -07:00 committed by GitHub
commit 853b9f87ab
2 changed files with 19 additions and 0 deletions

View File

@ -349,6 +349,9 @@ function mixinDiscovery(MySQL, mysql) {
case 'FLOAT':
case 'DOUBLE':
case 'BIGINT':
case 'INTEGER':
case 'DECIMAL':
case 'NUMERIC':
return 'Number';
case 'DATE':
case 'TIMESTAMP':

View File

@ -57,6 +57,22 @@ describe('MySQL specific datatypes', function() {
Account.destroyAll(done);
});
it('discover type of amount', function(done) {
db.discoverModelProperties('Account', {})
.then(function(defs) {
defs.forEach(function(props) {
if (props.columnName === 'amount') {
assert.deepEqual(props.dataType, 'decimal');
assert.deepEqual(props.type, 'Number');
done();
}
});
})
.catch(function(err) {
done(err);
});
});
it('create an instance', function(done) {
Account.create(data, function(err, result) {
if (err) return done(err);