© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago
ethan

error: type "userrole[]" does not exist

So when I'm running db:push I'm getting an error that the enum userrole doesnt exist. I have the enum here and it shows in the supabase enums list as well.

This is the code
enum
export const userRole = pgEnum("UserRole", ["ADMIN", "TEACHER", "DEVELOPER", "STUDENT", "ALUMNI", "GUEST"]);

table attr
roles: userRole("roles")
      .array()
      .default(sql`ARRAY['STUDENT']::UserRole[]`)
      .notNull()
enum
export const userRole = pgEnum("UserRole", ["ADMIN", "TEACHER", "DEVELOPER", "STUDENT", "ALUMNI", "GUEST"]);

table attr
roles: userRole("roles")
      .array()
      .default(sql`ARRAY['STUDENT']::UserRole[]`)
      .notNull()


This is the generated SQL
ALTER TABLE "users" ADD COLUMN "roles" UserRole[] DEFAULT ARRAY['STUDENT']::UserRole[] NOT NULL;
ALTER TABLE "users" ADD COLUMN "roles" UserRole[] DEFAULT ARRAY['STUDENT']::UserRole[] NOT NULL;


We're using drizzle kit version
0.21.2
0.21.2
.
Any help is appreciated, thank you!
image.png
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

error: type "userrole[]" does not exist
Drizzle TeamDTDrizzle Team / help
2y ago
Error migrating "type does not exist"
Drizzle TeamDTDrizzle Team / help
2y ago
Enum error type ... does not exist
Drizzle TeamDTDrizzle Team / help
2y ago
error: type "serial" does not exist
Drizzle TeamDTDrizzle Team / help
3y ago