elixir-sqlite/ecto_sqlite3

on_delete setting is casting uuids, which makes queries fail

Closed this issue · 6 comments

Repo.delete_all(Dresser.Schema.PieceImage |> where(piece_id: ^piece.id))

The above results in the following (working) query.

DELETE FROM "piece_images" AS p0 WHERE (p0."piece_id" = ?) ["f1511051-0079-448b-b0b9-562d71b0ad96"]

But deleting a (parent) record, where on_delete: :delete_all is set on a relationship (many_to_many here) I get the following query, which doesn't work:

DELETE FROM "piece_images" AS p0 WHERE (p0."piece_id" = CAST(? AS BLOB)) ["7e162d9e-3e22-4846-adf1-b4abd25966ac"]

The latter query works with the binary_id_type: :string setting (still casting, but to TEXT), but using binary_id_type: :binary it doesn't work.

exqlite 0.13.5 / ecto_sqlite3 0.10.3

@LostKobrakai can you provide me a minimum config to reproduce this? I'm going to chuck this into a test.

Awesome, I'll get to this in a bit. 👍🏻

@LostKobrakai I think this is effecting more than just delete_all. That where clause reuses the same code path.

I haven't forgotten about this. I did some test refactoring and broke them up into more maintainable chunks. I need to get this recreated.

@LostKobrakai This is fixed in #121 by @greg-rychlewski. I'll be releasing this shortly under the v0.10.4 version.