pubpub / platform

Open-source technology for creating full-stack knowledge applications for communities of all types.
https://knowledgefutures.org/pubpub
GNU General Public License v2.0
18 stars 2 forks source link

Spike: ORM/Query builder #39

Closed gabestein closed 1 year ago

gabestein commented 1 year ago

We're planning to use several postgres features that aren't well supported by Prisma, so we should investigate alternative sql query builders that will let us work with materialized views and json columns without losing type safety. The Prisma client also offers very little control over the actual queries, which will be challenging for us as we try to optimize them.

https://kysely.dev/ seems like a strong contender and they recommend https://github.com/kristiandupont/kanel/tree/main/packages/kanel-kysely to generate types via database introspection. This would be compatible with our existing Prisma schema generation.

Another one is Drizzley ORM.

In the long term, we might consider replacing Prisma entirely, since it seems the schema/migrations are also somewhat limited and designed in a way that doesn't really match how we'd like to work: https://github.com/prisma/prisma/issues/6974#issuecomment-1483792245

gabestein commented 1 year ago

Nothing immediately better -- there are some options, but to be addressed in near future.