Enums

const validStatuses = ["claimed", "confirmed", "started"] as const;
const statusEnum = pgEnum("status", validStatuses);
export type SessionStatus = typeof validStatuses[number];

export const trainingsTable = pgTable("training", {
date: text("date").primaryKey(),
host: text("host").notNull(),
status: statusEnum("status").notNull(),
notificationID: text("notification_id"),
notificationDeletionDate: timestamp("notification_deletion_date")
});
const validStatuses = ["claimed", "confirmed", "started"] as const;
const statusEnum = pgEnum("status", validStatuses);
export type SessionStatus = typeof validStatuses[number];

export const trainingsTable = pgTable("training", {
date: text("date").primaryKey(),
host: text("host").notNull(),
status: statusEnum("status").notNull(),
notificationID: text("notification_id"),
notificationDeletionDate: timestamp("notification_deletion_date")
});
When I run drizzle-kit push --config=src/db/config.ts it returns error: type "status" does not exist, how do I fix this?
6 Replies
ethan!
ethan!OP7mo ago
@Andrew Sherman sorry for the ping but it's quite urgent
Andrii Sherman
Andrii Sherman7mo ago
looking into it
ethan!
ethan!OP7mo ago
thank you
lanc3
lanc37mo ago
You probably need to export that enum otherwise drizzle will not pick it up
Andrii Sherman
Andrii Sherman7mo ago
nice catch yeah didn't see export is missing
ethan!
ethan!OP7mo ago
worked, thank you!
Want results from more Discord servers?
Add your server