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

Commit b9b5c4ff by Johannes Würbach

Respect custom field names in json queries

Instead of using the first part of the key directly, respect
defined custom field names
1 parent a6508a8a
# Next # Next
- [FIXED] Custom field names in json queries
- [FIXED] JSON cast key using the equality operator. [#3824](https://github.com/sequelize/sequelize/issues/3824) - [FIXED] JSON cast key using the equality operator. [#3824](https://github.com/sequelize/sequelize/issues/3824)
- [FIXED] Map column names with `.field` in scopes with includes. [#4210](https://github.com/sequelize/sequelize/issues/4210) - [FIXED] Map column names with `.field` in scopes with includes. [#4210](https://github.com/sequelize/sequelize/issues/4210)
- [FIXED] `addScope` when the model does not have any initial scopes [#4243](https://github.com/sequelize/sequelize/issues/4243) - [FIXED] `addScope` when the model does not have any initial scopes [#4243](https://github.com/sequelize/sequelize/issues/4243)
......
...@@ -1820,7 +1820,7 @@ var QueryGenerator = { ...@@ -1820,7 +1820,7 @@ var QueryGenerator = {
value = {}; value = {};
Dottie.set(value, key.split('.').slice(1), tmp); Dottie.set(value, key.split('.').slice(1), tmp);
key = key.split('.')[0]; key = field.field || key.split('.')[0];
} }
} }
......
...@@ -657,6 +657,20 @@ suite(Support.getTestDialectTeaser('SQL'), function() { ...@@ -657,6 +657,20 @@ suite(Support.getTestDialectTeaser('SQL'), function() {
}, { }, {
default: '[data] @> \'{"company":"Magnafone"}\'' default: '[data] @> \'{"company":"Magnafone"}\''
}); });
testsql('metaData.nested.attribute', 'value', {
model: {
rawAttributes: {
metaData: {
field: 'meta_data',
fieldName: 'metaData',
type: new DataTypes.JSONB()
}
}
}
}, {
default: "([meta_data]#>>'{nested, attribute}') = 'value'"
});
}); });
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!