DEV Community

Discussion on: Repository Pattern with Typescript and Node.js

Collapse
 
highasthedn profile image
highasthedn

Prisma looks quite awesome but knex has three features we need in our software which I could not do with Prisma.

  1. Run migrations programmatically without cli
  2. Run different sets of migrations (we have to different database schemas)
  3. Select the database connection dynamically on each api call

Those features are running rock solid with knex, in combination with Objection I have a good typescript support. Knex might look not as fancy as Prisma and feels more old fashioned, but I would not switch to Prisma in their current stage of development

Collapse
 
joaolss profile image
João Lucas Silva
  1. We use exec to run migrations programmatically using the CLI, not perfect but works just fine
  2. You are able to have multiple schema files and manage multiple migrations
  3. You are able to select the database connection dynamically when initializing prisma client

Of course knex is not garbage, and it's been one of the most used query builders for ages, but in my company we are making the transition from knex to prisma because as i said in another comment, the advantages are greater than the drawbacks