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

Commit d05004ef by Alex Young

Adds support for Sequelize.DECIMAL, which takes optional arguments for precision…

… and scale.  Fixes #232
1 parent 197a0fb0
Showing with 27 additions and 0 deletions
...@@ -8,5 +8,12 @@ module.exports = { ...@@ -8,5 +8,12 @@ module.exports = {
FLOAT: 'FLOAT', FLOAT: 'FLOAT',
NOW: 'NOW', NOW: 'NOW',
ENUM: 'ENUM', ENUM: 'ENUM',
get DECIMAL() {
var ret = function(precision, scale) {
return 'DECIMAL(' + precision + ',' + scale + ')';
};
ret.toString = ret.valueOf = function() { return 'DECIMAL'; };
return ret;
},
ARRAY: function(type) { return type + '[]' } ARRAY: function(type) { return type + '[]' }
} }
if(typeof require === 'function') {
const buster = require("buster")
, Sequelize = require("../index")
, Helpers = require('./buster-helpers')
, dialect = Helpers.getTestDialect()
}
buster.spec.expose()
describe(Helpers.getTestDialectTeaser('Data types'), function() {
if (dialect == 'mysql') {
it('should return DECIMAL for the default decimal type', function() {
expect(Sequelize.DECIMAL).toEqual('DECIMAL');
});
it('should return DECIMAL(10,2) for the default decimal type with arguments', function() {
expect(Sequelize.DECIMAL(10, 2)).toEqual('DECIMAL(10,2)');
});
}
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!