Enum in Unique Constraint throws error.

Environment: drizzle-orm "0.36.0"
I have one file that has an enum:
export const myEnum = pgEnum('myEnum', ['A', 'B', 'C']);

In another file I am importing that enum and using it for a column in my table with a unique check over multiple columns:
export const myTable = pgTable('my_table', {
  id: uuid('id').primaryKey().defaultRandom(),
  a: uuid('a').notNull(),
  b: uuid('b').notNull(),
  c: myEnum('c').notNull(),
}, table => [
  unique('my_unique_constraint').on(table.a, table.b, table.c)
]);

I get the following error message when executing:
TypeError: (0 , _1.myEnum) is not a function
    at Object.<anonymous> (/Users/swifty/Work/platform/apps/api/src/drizzle/notifications/job-subscriptions.schema.ts:16:41)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/Users/swifty/Work/platform/apps/api/src/drizzle/notifications/index.ts:12:1)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)

Node.js v20.11.0

When removing the constraint or moving the enum to the same file (which is not possible since I need it in multiple places) the error disappears. Does anyone have any clue why this happens?
Was this page helpful?