Self referencing column breaks table type in typescript
I have the following table:
However typescript infers the type of
categoriesTable
as any
It's only when I remove .references(() => categoriesTable.id, { onDelete: 'set null' })
that typescript infers the type correctly
If so, how can I still create a self reference in this case?1 Reply
https://orm.drizzle.team/docs/indexes-constraints#foreign-key
there's an example a little below
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.