Repository navigation
Conversation
|
If there are other open issues related to |
f6c4702 to
011e387
Compare
|
Looking at the goals of this PR I don't really see any breaking changes. Is that correct? Since I do not think we'll land this in the initial release of v7 but postponing it to v8 would also be a waste |
|
There is one breaking change: Writing the following is no longer supported import { where, col } from '@sequelize/core';
User.findAll({
where: where(col("a"), '=', col("b"))
})instead users need to write the following: import { where, col, Op } from '@sequelize/core';
User.findAll({
where: where(col("a"), Op.eq, col("b"))
});This is because If the user needs to use a custom operator, they can do this instead: import { sql, col } from '@sequelize/core';
User.findAll({
where: sql`${col("a")} = ${col("b")}}`
});Well... once I get to it #14299 I wouldn't worry about whether this gets postponed to v8. It's such a massive amount of work, I haven't been able to finish it in the past year. I think I'm better equipped to handle it now but I still have so many other things in progress to complete first that it may not be ready until it's time to consider releasing v8 :( |
|
No worries about working on it for v8, v7 already has some nice new and improved features that this can wait a bit. Thanks for the information! |
|
Replaced by #15598 |
Large WIP PR to completely rewrite how
WHEREis generated.This PR is dependent on #14022, as unit tests & types must be improved first to ensure this PR doesn't break anything.
It's definitely not ready yet. A lot of tests are still failing.
The bulk of changes are in https://github.com/sequelize/sequelize/blob/ephys/new-where-builder/lib/dialects/abstract/where-sql-builder.ts
The new system is much more type-safe, with each operator being typed individually.
With this new system, it's also easier for dialects to override how an operator is built. They can override the method specific to that operator without needing to modify the other.
Closes #13602
Closes #13753
Goals of this PR:
whereto TypeScriptSequelize.where()and pojo where objects (i.e.where: { firstName: 'zoé' }). FixesOp.notoperator is ignored when used withSequelize.where()#13602{ attribute: value }and{ attribute: { [Op.eq]: value } }Sequelize.attras a attributeName-aware alternative toSequelize.colSequelize.literal(eg.Sequelize.literal('name = ?name', { name: 'my name' })){ attribute: { [Op.in]: new Set([1,2,3]) } })whereobject should throw with a message describing what is invalid, instead of crashing with an obscure message.orinside another operator:{ id: { [Op.eq]: or(1, 2) } }should functionTODO
where:Sequelize.where([], Op.eq, [])types/where.tsare actually testedOp.anyandOp.allare supported in all/most operatorsIncludeOptions.on#14114 is fixedliteralinOp.match: FullText support syntax incorrect for MySQL #14051