wantpinow
wantpinow
DTDrizzle Team
Created by wantpinow on 6/20/2024 in #help
Type Hinting $inferSelect
Hi Drizzle Team, I have the following tables set up with Postgres and Drizzle. There is a reviews table with an enum status field. When the status is assigned, the userId field is non-null, otherwise it's null. Is there a way to typehint reviews.$inferSelect such that it adheres to the type logic above?
export const status = pgEnum("status", ["unassigned", "assigned"]);
export const reviews = createTable("review", {
id: uuid("id").defaultRandom().primaryKey(),
status: status("status").notNull(),
userId: uuid("user_id"), // set if the review status is 'assigned'
});
export const status = pgEnum("status", ["unassigned", "assigned"]);
export const reviews = createTable("review", {
id: uuid("id").defaultRandom().primaryKey(),
status: status("status").notNull(),
userId: uuid("user_id"), // set if the review status is 'assigned'
});
1 replies