© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
1 reply
Muhannad

pgEnum in multiple tables

How should I use the same enum in multiple tables?
For example I have this enum in:
const ROLES = ['owner', 'admin', 'editor', 'viewer'] as const
const roleEnum = pgEnum('role', ROLES)
// in table I use it like this:
role: roleEnum('role')
const ROLES = ['owner', 'admin', 'editor', 'viewer'] as const
const roleEnum = pgEnum('role', ROLES)
// in table I use it like this:
role: roleEnum('role')

If I want to use the same role enum in another table should I use the same pgEnum `const roleEnum = pgEnum('role', ROLES) i.e. import it? Or create the same pgEnum again?
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

Renaming pgEnum results in truncation?
Drizzle TeamDTDrizzle Team / help
3y ago
PGEnum -> Typescript Enum
Drizzle TeamDTDrizzle Team / help
3y ago
db.select().from(multiple tables)
Drizzle TeamDTDrizzle Team / help
2y ago
Where clauses across multiple tables in relational queries
Drizzle TeamDTDrizzle Team / help
3y ago