-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: reproduce the bug reported in #185
- Loading branch information
1 parent
4d14204
commit 4f4b407
Showing
1 changed file
with
10 additions
and
0 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 |
---|---|---|
|
@@ -115,6 +115,16 @@ defmodule Ecto.SoftDelete.Repo.Test do | |
assert Enum.member?(results, soft_deleted_user) | ||
end | ||
|
||
test "handles subquery that does not expose deleted_at as 'main' schema" do | ||
Repo.insert!(%User{email: "[email protected]"}) | ||
Repo.insert!(%Nondeletable{value: "stuff"}) | ||
|
||
subq = User |> where([u], u.email == "[email protected]") |> select([u], %{id: u.id, email: u.email}) | ||
query = subquery(subq) |> join(:left, [u], nondel in Nondeletable, on: u.id == nondel.id) | ||
|
||
Repo.all(query) | ||
end | ||
|
||
test "includes soft deleted records if where not is_nil(deleted_at) clause is present" do | ||
user = Repo.insert!(%User{email: "[email protected]"}) | ||
|
||
|