Refactor CRUD::delete method to support advanced DELETE queries#25
Refactor CRUD::delete method to support advanced DELETE queries#25
CRUD::delete method to support advanced DELETE queries#25Conversation
… support advanced DELETE queries
|
@defunctl I've updated the test approach. |
@shvlv I was suggesting 2.0.0 because this changes the underlying functionality of a used method, but is also a bug fix. Are there no scenarios you can think of where someone is unintentionally relying on existing functionality and this update could break things for them, even though we're correcting the logic? |
For the current functionality, the only way it works as expected is to use only a simple DB::table('posts')
->where('post_type', 'delete_like_test')
->delete();If someone used something different, like |
That is my exact worry. That they even wrote tests for those buggy results, so it's really just a question of do we want to potentially release that type of issue right now, or when they move to 2.0.0 which is more expected with a major release that things could "break" |
borkweb
left a comment
There was a problem hiding this comment.
I love this change and the code looks great, @shvlv. The likelihood that this will cause problems with current uses out in the wild is incredibly low due to the nature of how limited the delete() call was.
I'm ok with 1.2 and accept that there may be annoying edge case bugs that'll creep up due to bad implementations elsewhere.
|
@dpanta94 has put some good work on this should be aware of the changes. |
The current implementation relies on
wpdb::deletethat supports the simplewhere x = yconditions only. It's not only incomplete but also dangerous becauseWhere::$comparisonOperatorandWhere::$logicalOperatorare just ignored, so the result is unpredictable. The following change provides a way to use existing QueryBuilder functionality to generateDELETESQL. The documentation describes some restrictions.Additionally, I updated
actions/cachetov4to make CI tests run.