-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nexus-db-queries] remove uses of filter_target (#5052)
`filter_target` is required for partial indexes but is easy to misuse for full indexes. To work around that, define an `as_partial_index` method, switch to it, and ban general uses of `filter_target` via clippy. `as_partial_index` adds a `WHERE false` clause. See the comments included in the PR for why that works. The rest of the PR: * Makes sure clippy's `disallowed_` lints are active. `-A clippy::style` disables them. * Adds some missing tests (thanks @jmpesp) * Fixes a `RunnableQuery` that often did not return anything, replacing it with `RunnableQueryNoReturn`.
- Loading branch information
1 parent
6003a5a
commit 97dfaf0
Showing
8 changed files
with
404 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
disallowed-methods = [ | ||
# `ON CONFLICT ... WHERE ... DO UPDATE` is easy to misuse. | ||
# | ||
# If you mean a conditional upsert, import | ||
# diesel::query_dsl::methods::FilterDsl, then use | ||
# `do_update().set(...).filter(...)`. (This is not part of the | ||
# documentation as of Diesel 2.1.4, but it works.) | ||
# | ||
# If you mean to specify a bound on a partial index, use the | ||
# `IncompleteOnConflictExt::as_partial_index` in `nexus-db-queries`. | ||
# See the documentation of that method for more. | ||
"diesel::upsert::DecoratableTarget::filter_target", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.