I truly believe that you should spend 0 time migrating SQL query to code.
When you design data persistence - you do it in SQL domain, when you solve business demands in data domain - you do it in SQL. When you know how to solve problem in SQL - you should straight away know how to do it with ORM
ORM should embrace SQL and not hide it under the carpet. By doing that many other ORMs supply you with hidden consequences