3 ms·
I have a laravel project for which all of my models are raw SQL statements for this reason. At the very least, it makes the code more portable, and it makes it
by krapp 12y ago
I have a laravel project for which all of my models are raw SQL statements for this reason. At the very least, it makes the code more portable, and it makes it easier to reason about the statements when you can actually see them.
- xienze 12y agoIt makes your code less portable. Raw SQL means you're essentially tied to a single DB provider. What happens when you need to move to a different one?
- deleted 12y ago[deleted]
- krapp 12y agoSorry... I meant more portable between applications (assuming you're willing to stick with SQL), obviously not between database providers.
- JimBarrows 12y agoWhat if you don't need to move to a different one?
- Xorlev 12y agoThen you should probably rewrite your statements anyways to take advantage of platform-specific features. I won't write a query on MySQL the same as I would on Postgres, because there's usually a better way. CRUD is about all that can honestly stay the same, as IMO that's where ORMs shine.
- aikah 12y ago> At the very least, it makes the code more portable How writing SQL make your code more portable ? using an abstraction make something portable.SQL implementations are differents from one table to another.
- krapp 12y agoUsing an ORM ties you to that implementation. I can more easily take a raw SQL statement and use it elsewhere.
- deleted 12y ago[deleted]