kgrzybek / modular-monolith-with-ddd

Full Modular Monolith application with Domain-Driven Design approach.
MIT License
11.12k stars 1.75k forks source link

SQL in Queries are DB specific #129

Open JacekSmi opened 4 years ago

JacekSmi commented 4 years ago

Hi @kgrzybek First thanks for publishing this repo. I appreciate your work. When I check part about Queries I see that you are using raw SQL to get data from database what is OK but you are using square bracket what leads you to use MS database. Problem is that when you want to migrate one module or all app to different DB you will need to rewrite all SQL's 👎

Second thing is that I think all that raw SQL should be moved to a repository class per each module to have it all in one place, so when you will switch to other DB this could be kind of trade-off if you want to stay with square bracket

Please let me know what do you think

AymanSharaf commented 4 years ago

126 @kgrzybek Replied to similar concerns (especially the first one) in this issue.

kgrzybek commented 4 years ago

Hi @JacekSmi ,

As @AymanSharaf noticed, I answered some time ago to a similar question (second part). TLDR; I advise to not abstract from database on application layer on query side because it does not give you a value. If you want to change db you still need to rewrite SQL statements at some level.

About brackets - imo it is not a big deal because you can remove them easily using find and replace tool. I like to have it, but maybe I think it is matter of choice.