zio / zio-sql

Type-safe, composable SQL for ZIO applications
https://zio.dev/zio-sql/
Apache License 2.0
236 stars 116 forks source link

need to be able to delete from joined tables #43

Open robmwalsh opened 4 years ago

robmwalsh commented 4 years ago

split from #37

All major dialects provide some way to delete from a joined table but the table to be deleted from needs to be explicitly provided. We could specify a "zio-sql" way of doing this (with dialect specific implementations) e.g. I'd suggest

delete(orders).from((orders join users).on(fkUserId === userId)).where(fName === "Fred")

or we could just disallow this and let the dialect specific modules introduce the concept of deleting from a join in a manner similar to the dialect of choice (e.g. using for postgres)

jdegoes commented 4 years ago

I like the proposed syntax. We should support this and translate to dialect-specific variants in the rendering.