Circular Reference in Schema Relation
I'm trying the following:
As soon as I uncomment the primaryMetadataId, I get a bunch of typescript errors. In this case every metadata should belong to a page but the page may select one as "primary". I believe this could be done with a join table, but I'd rather just have the schema clean
8 Replies
Prisma allows this like this
You need to type the
references(():AnyPgColumn => ...)
Drizzle Run
Circular references - Drizzle Run
that's a typescript issue :/
Thank you very much!!!
Is this documented anywhere?
did you get this to work with those onDelete: "cascades" in there? I am failing to get that to work!
Yes it worked for me
What issue are you having?
drizzle migrate
tool fails with TypeError: Cannot read properties of undefined (reading 'id') at mytable.myfield.references.onDelete
seems to be related to the order esm modules are getting evaluated. i have a circular reference between two pgTables in two modules, and now none of my other tables can refer to one of those two in the circle without migrate failing.