ecto_soft_delete icon indicating copy to clipboard operation
ecto_soft_delete copied to clipboard

On master, `prepare_query` adds clause to non soft-deletable tables

Open caioaao opened this issue 3 months ago • 1 comments

I tried running the tests from my company's repo using the master branch and it fails. It seems that now it tries to add the deleted_at IS NULL query where it shouldn't. Here's a sample of the error when running our tests (pretty printed and redacted query, but tried to keep the overall structure for reference):

  ** (Postgrex.Error) ERROR 42703 (undefined_column) column s0.deleted_at does not exist

SELECT s0."id", i1."id", i1."xxx_id", ...
FROM (SELECT DISTINCT ON (sl0."id") sl0."id" AS "id"
	FROM "yyys" AS sl0 
	INNER JOIN  ...
	INNER JOIN ...
	WHERE (...  AND (sl0."deleted_at" IS NULL)) ) AS s0 
INNER JOIN ... 
WHERE ... AND (s0."deleted_at" IS NULL)

I checked and v 2.0.4 works correctly. It seems like PR #141 might have introduced this

caioaao avatar Oct 26 '24 13:10 caioaao