© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
3 replies
louis

Reference the same table

Hello,
I use drizzle with a sqlite d1 database.

I have the following schema:
export const authUser = sqliteTable("auth_user", {
  id: text("id").notNull().primaryKey(),
  email: text("email").notNull().unique(),
  firstName: text("first_name").notNull(),
  lastName: text("last_name").notNull(),
  role: text("role").notNull(), // unassigned, office, construction
  verified: integer("verified", { mode: "boolean" }).notNull(),
  manager: text("user_id").references(() => authUser.id),
});
export const authUser = sqliteTable("auth_user", {
  id: text("id").notNull().primaryKey(),
  email: text("email").notNull().unique(),
  firstName: text("first_name").notNull(),
  lastName: text("last_name").notNull(),
  role: text("role").notNull(), // unassigned, office, construction
  verified: integer("verified", { mode: "boolean" }).notNull(),
  manager: text("user_id").references(() => authUser.id),
});


But it get the following error:
typescript: 'authUser' implicitly has type 'any' because it does not have a type annotation and is
referenced directly or indirectly in its own initializer.

How can i fix this?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to reference the same table in the table's definition?
Drizzle TeamDTDrizzle Team / help
2y ago
relations to the same table
Drizzle TeamDTDrizzle Team / help
2y ago
reference table name as const
Drizzle TeamDTDrizzle Team / help
11mo ago
generated columns reference another table
Drizzle TeamDTDrizzle Team / help
2y ago