4 ms·
99% of the time you should'be be composing SQL. If you need composition at the DB level, that is what Views are for.
by platz 6y ago
99% of the time you should'be be composing SQL.
If you need composition at the DB level, that is what Views are for.
- treis 6y agoI'm not sure why you think we shouldn't be composing SQL. What about for cases like: User.banned.posts.flagged where we want all flagged posts from banned users. Posts.flagged.today where we want all flagged posts from today User.created_today.posts.flagged where we want all flagged posts from users created today
- platz 6y agoOr you could just create a View for flagged posts and join on that as appropriate, no ORM needed. There's probably some room for limited compositional SQL, but there are ways to get that without a full ORM, given your type system is expressive enough.