Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rewrite the part of QueryGenerator responsible for WHERE (#15598)
- The `Op.not` operator *always* means `NOT (x)`. If you need `IS NOT`, use `Op.isNot`, if you need `!=`, use `Op.ne`. This should not impact you much however, because writing `{ [Op.not]: 1 }` will be interpreted as `{ [Op.not]: { [Op.eq]: 1 } }` and will result in `NOT (x = 1)` instead of `x != 1` - Removed the ability to use string operators in `where` (use the `sql` tag for that) - Removed operator aliases (they were deprecated since Sequelize 5) - Removed the ability to use an attribute object (one of the values of `Model.rawAttributes`) as one of the operands of `where`, it made little sense, was undocumented, and complicated the code. - `or([])` & `or({})` produce `''` instead of `'0=1'` - `not({})` produces `''` instead of `'0=1'` - JSON operations now produce JSON strings (`->` operator) instead of unquoting them (`->>` operator) to fix #15238 - The `Json` class, that is produced by `json()` has been removed. `json()` now returns either `Where` or `Attribute` depending on its parameters. - `json()` only accepts the sequelize JSON notation, it will not accept the dialect-specific syntaxes, or `json()` functions anymore. Use the `sql` tag, `literal` or `fn` for that - Array values in replacements are not escaped as SQL Lists anymore, but as SQL arrays. If the user wishes to use a list, they need to wrap their array with the new `list()` method - The signature of the `escape` method has changed. `escape` is now able to handle any SQL value (dynamic like `fn` or literal like `'a string'`) and accepts a `bindParam` option which can be used to make it add bind parameters instead of escaping - Removed the ability to pass the value of the primary key directly to `where`. `User.findOne({ where: 1 })` will throw. Use `User.findByPk(1)` instead. - `SequelizeMethod` has been renamed to `BaseSqlExpression`
- Loading branch information