joeet
joeet
DTDrizzle Team
Created by joeet on 8/8/2024 in #help
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),
}),
);
4 replies