Comment

Comment by abaldwin99

I'm completely perplexed at some of the functionality that's absent in Prisma? I'm coming from the Rails/Django world for reference. Can anyone help me understand if I'm out in left field or does this technology only cover basic use cases?

  - No supported way to do a case-insensitive sorting.  https://github.com/prisma/prisma/issues/5068
  - Can’t sort by an aggregate value like user’s post count. https://github.com/prisma/prisma/issues/3821
  - Can’t control between inner/left join.
  - Can’t do subqueries.
  - Migration rollbacks are experimental maybe unsupported now? At least I only see mention in Github issues and not in the docs.
  - Transactions appear to expect a series of queries? It doesn’t look like you can execute any app code during a transaction?
  - No support for pessimistic row locking e.g. SELECT… FOR UPDATE ?
  - No way to mixin raw query partials like `where('name ILIKE ?')`. You either need to write the whole query raw or not.
  - Validations are done at the database level.
    - Complex validations seem tricky to write in this format
    - No built-in way to make clean user-facing validation messages.
    - You can’t check that a model instance is valid without just trying to insert it into the database
  - The official documented validation example has you connecting via psql and adding a constraint?
    - So following the offical example my validations aren’t documented in the codebase via a model or a migration? 
    - Also they don’t have a validation example documented if you’re using MySQL instead of Postgres?
  - Cascading deletes are handled the same way as validations. As in Prisma basically does nothing other than document how to implement it yourself outside of the library.
  - No model methods. I guess that's not a surprised because it's "not an ORM". A model really is just a data mapping? Anyways it seems like you would end up rolling your own wrapper around this and there's no recommendations on standardized architecture.
  - No callbacks. These have been controversial at times so are teams using Prisma writing something akin to "services" instead?
  - Syntax nitpick but one of these is vulnerable to a SQL injection and it seems really easy for a new developer to get mixed up?
    - prisma.$queryRaw(`SELECT \* FROM User WHERE email = ${email}`);
    - prisma.$queryRaw`SELECT \* FROM User WHERE email = ${email}`;
  - No way of batch loading like Active Records’s find_in_batches / find_each. All objects are just loaded into memory?
  - No way of hooking into queries for instrumentation. e.g. ActiveSupport::Notifications.subscribe
FYI - This is after fairly brief research. Not guaranteed 100% accurate.
parent abaldwin99 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton