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

Commit e3bc9ce9 by Mick Hansen

fix(sql/where): store sequelize.json support, closes #3138

1 parent d72b8517
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
- [BUG] Support for plain strings, ints and bools on JSON insert - [BUG] Support for plain strings, ints and bools on JSON insert
- [BUG] Fixed regression where `{$in: []}` would result in `IN ()` rather than `IN (NULL)` [#3105](https://github.com/sequelize/sequelize/issues/3105) [#3132](https://github.com/sequelize/sequelize/issues/3132) - [BUG] Fixed regression where `{$in: []}` would result in `IN ()` rather than `IN (NULL)` [#3105](https://github.com/sequelize/sequelize/issues/3105) [#3132](https://github.com/sequelize/sequelize/issues/3132)
- [BUG] Fixed bug where 2 x `belongsToMany` with `foreignKey` but no `otherKey` defined would result in 3 keys instead of 2. [#2991](https://github.com/sequelize/sequelize/issues/2991) - [BUG] Fixed bug where 2 x `belongsToMany` with `foreignKey` but no `otherKey` defined would result in 3 keys instead of 2. [#2991](https://github.com/sequelize/sequelize/issues/2991)
- [BUG] Fixed regression with `where: sequelize.json()`, [#3138](https://github.com/sequelize/sequelize/issues/3138)
# 2.0.2 # 2.0.2
- [BUG] Fixed regression with `DataTypes.ARRAY(DataTypes.STRING(length))` [#3106](https://github.com/sequelize/sequelize/issues/3106) - [BUG] Fixed regression with `DataTypes.ARRAY(DataTypes.STRING(length))` [#3106](https://github.com/sequelize/sequelize/issues/3106)
......
...@@ -1639,7 +1639,7 @@ module.exports = (function() { ...@@ -1639,7 +1639,7 @@ module.exports = (function() {
} }
} }
if (value instanceof Utils.literal || value instanceof Utils.where) { if (value && value._isSequelizeMethod) {
return this.handleSequelizeMethod(value); return this.handleSequelizeMethod(value);
} }
......
...@@ -345,5 +345,15 @@ suite(Support.getTestDialectTeaser('SQL'), function() { ...@@ -345,5 +345,15 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
}); });
}); });
} }
if (current.dialect.supports.JSON) {
suite('JSON', function () {
test('sequelize.json("profile->>\'id\', sequelize.cast(2, \'text\')")', function () {
expectsql(sql.whereItemQuery(undefined, this.sequelize.json("profile->>'id'", this.sequelize.cast('12346-78912', 'text'))), {
postgres: "profile->>'id' = CAST('12346-78912' AS TEXT)"
});
});
});
}
}); });
}); });
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!