Feb 25, 2022
That is bad, avoid bringing any kind of logic to your DB / queries etc. It's harder to test as just integration and acceptance tests can get it, they are slow and costly.
Abstract the logic into domain layer and cover with unit test, it's the way to go.