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

Commit fe3e1c5f by Jan Aagaard Meier

bug(json) Cast to boolean when querying JSON. Closes #4257

1 parent 7d668dda
......@@ -2,6 +2,7 @@
- [FIXED] Fall back to a default version when parsing the DB version fails [#4368](https://github.com/sequelize/sequelize/issues/4368)
- [FIXED] Fix a bug where passing null as the second parameter to `sequelize.where` would fail [#4334](https://github.com/sequelize/sequelize/issues/4334)
- [FIXED] An error is thrown if a column called `id` is added, but not marked as primary key, and no other pk is present. [#4139](https://github.com/sequelize/sequelize/issues/4139)
- [FIXED] Cast to boolean when querying JSON [#4257](https://github.com/sequelize/sequelize/issues/4257)
# 3.6.0
- [ADDED] Model.findCreateFind: A more performant findOrCreate that will not work under a transaction (atleast not in postgres)
......
......@@ -1986,10 +1986,10 @@ var QueryGenerator = {
if (!$cast) {
if (typeof $item === 'number') {
$cast = 'double precision';
}
if ($item instanceof Date) {
} else if ($item instanceof Date) {
$cast = 'timestamptz';
} else if (typeof $item === 'boolean') {
$cast = 'boolean';
}
}
......
......@@ -647,6 +647,18 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
});
testsql('data', {
nested: {
attribute: true
}
}, {
field: {
type: new DataTypes.JSONB()
}
}, {
default: "([data]#>>'{nested, attribute}')::boolean = true"
});
testsql('data', {
$contains: {
company: 'Magnafone'
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!