Enum error type ... does not exist

I am getting the error type ... does not exist for all of my enums. I have tried all the suggestions I could fine, from snake case, exporting the enums and I am still getting this error. Drizzle orm is version: 0.32.2 Drizzle kit is version: 0.24.00 example:
export const invitationStatusEnum = pgEnum("invitation_status", [
"pending",
"accepted",
"declined",
]);

export const agencyInvitation = pgTable(
"agency_invitation",
{
id: serial("id").primaryKey(),
agencyId: integer("agency_id")
.notNull()
.references(() => agency.id),
userId: integer("user_id")
.notNull()
.references(() => user.id),
status: invitationStatusEnum("status").notNull().default("pending"),
invitedAt: timestamp("invited_at", { mode: "string" })
.notNull()
.defaultNow(),
respondedAt: timestamp("responded_at", { mode: "string" }),
},
(table) => ({
agencyIdIdx: index("agency_invitation_agency_id_idx").on(table.agencyId),
userIdIdx: index("agency_invitation_user_id_idx").on(table.userId),
statusIdx: index("agency_invitation_status_idx").on(table.status),
uniqueInvitationIdx: index(
"agency_invitation_unique_agency_invitation_idx",
).on(table.agencyId, table.userId),
}),
);
export const invitationStatusEnum = pgEnum("invitation_status", [
"pending",
"accepted",
"declined",
]);

export const agencyInvitation = pgTable(
"agency_invitation",
{
id: serial("id").primaryKey(),
agencyId: integer("agency_id")
.notNull()
.references(() => agency.id),
userId: integer("user_id")
.notNull()
.references(() => user.id),
status: invitationStatusEnum("status").notNull().default("pending"),
invitedAt: timestamp("invited_at", { mode: "string" })
.notNull()
.defaultNow(),
respondedAt: timestamp("responded_at", { mode: "string" }),
},
(table) => ({
agencyIdIdx: index("agency_invitation_agency_id_idx").on(table.agencyId),
userIdIdx: index("agency_invitation_user_id_idx").on(table.userId),
statusIdx: index("agency_invitation_status_idx").on(table.status),
uniqueInvitationIdx: index(
"agency_invitation_unique_agency_invitation_idx",
).on(table.agencyId, table.userId),
}),
);
2 Replies
francis
francis5mo ago
is this a runtime or type error? I copied this into my drizzle schema and it works fine. (once I removed the references I don't have)
joeet
joeetOP5mo ago
run time I changed it to text with the enum field and it works fine now
Want results from more Discord servers?
Add your server