Skip to content

Commit

Permalink
chore: reproduce the bug reported in #185
Browse files Browse the repository at this point in the history
  • Loading branch information
grossvogel committed Oct 28, 2024
1 parent 4d14204 commit 4f4b407
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/soft_delete_repo_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check failure on line 118 in test/soft_delete_repo_test.exs

View workflow job for this annotation

GitHub Actions / Test on OTP 21 / Elixir 1.11

test prepare_query/3 handles subquery that does not expose deleted_at as 'main' schema (Ecto.SoftDelete.Repo.Test)
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]"})

Expand Down

0 comments on commit 4f4b407

Please sign in to comment.