Self-Relation in Drizzle ORM?

I'm trying to create a folder/file structure in postgresql with drizzle orm
I have the following table:
export const folder = pgTable("folders", {
    id: uuid("id").primaryKey(),
    name: varchar("name", {length: 64}).notNull(),
    parent: uuid("parent").references(() => folder.id),
    owner: uuid("owner").references(() => user.id),
    color: varchar("color", {length: 7}).notNull(),
    level: integer("level").notNull(),
    createdAt: timestamp("createdAt").defaultNow().notNull(),
    updatedAt: timestamp("updatedAt").defaultNow().notNull()
})


but im getting this error in typescript
'folder' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)

Sorry if I overlooked something, I'm new to drizzle
image.png
Was this page helpful?