fdarian / prisma-generator-drizzle

A Prisma generator for generating Drizzle schema with ease
90 stars 10 forks source link

Circular dependency on generated schema #11

Closed fdarian closed 6 months ago

fdarian commented 6 months ago

Simply separate all definitions into a single module

This issue raised from these comments: https://github.com/farreldarian/prisma-generator-drizzle/issues/1#issuecomment-1873605305 https://github.com/farreldarian/prisma-generator-drizzle/issues/1#issuecomment-1873616242

fdarian commented 6 months ago

Doing it rn

fdarian commented 6 months ago

Hi @octalpixel, I just added the PR to properly fix the circular dependencies. Could you please confirm by using 0.5.4-9955142 resolves the issue?

Regarding your solutions:

Have a flag to output everything to one file. (Fixes the require cycle for React Native projects)

I think It'd be an extra work to sort the const definitions whoever should be declared first or later. Also it should be better for the editor's performance

Have a flag to output relationship to another file

This PR will make that as the default

Flag to only generate relationships (This can actually be a good starting point to learn about how to make relationships with Drizzle as well)

The main focus currently is to use Drizzle from Prisma schema — a drop-in replacement for their prisma client engine. However please feel free to raise an issue describing the motivation and examples to see how many people upvote this.

octalpixel commented 6 months ago

Will check this out! Thanks for the addressing this