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

Commit cf232e76 by Kristijan Trajkovski Committed by Jan Aagaard Meier

Fixed range integer parsing (#6897)

* Fixed range integer parsing

* Added test for integer ranges

* Removing console.log and add inclusion assertions
1 parent d5caff24
......@@ -338,8 +338,8 @@ module.exports = function (BaseTypes) {
var RANGE = BaseTypes.RANGE.inherits();
RANGE.oid_map = {
3904: 1007, // int4
3905: 1007,
3904: 23, // int4
3905: 23,
3906: 1700, // Numeric
3907: 1700,
3908: 1114, // timestamp
......
......@@ -362,6 +362,33 @@ describe(Support.getTestDialectTeaser('DataTypes'), function() {
expect(user.get('decimalWithFloatParser')).to.be.eql('0.12345678');
});
});
it('should return Int4 range properly #5747 and #6896', function() {
var Model = this.sequelize.define('M', {
interval: {
type: Sequelize.RANGE(Sequelize.INTEGER),
allowNull: false,
unique: true
}
});
return Model.sync({ force: true })
.then(function() {
return Model.create({ interval: [
{value: 1, inclusive: true},
{value: 4, inclusive: false}
] });
})
.then(function(){
return Model.findAll();
})
.spread(function(m){
expect(m.interval.inclusive[0]).to.be.eql(true);
expect(m.interval.inclusive[1]).to.be.eql(false);
expect(m.interval[0]).to.be.eql(1);
expect(m.interval[1]).to.be.eql(4);
});
});
}
});
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!