How do I create a fk to a uuid column?
My schema:
When I try to push this I get
export const overlaysTable = pgTable("overlays", {
id: uuid("id").notNull().defaultRandom().primaryKey(),
ownerId: varchar("owner_id")
.notNull()
.references(() => usersTable.id, { onDelete: "cascade" }),
name: varchar("name").notNull(),
status: varchar("status").$type<StatusOptions>().notNull(),
type: varchar("type").$type<OverlayType>().notNull(),
rewardId: varchar("reward_id"),
});
export const queTable = pgTable("clipQue", {
id: uuid("id").notNull().defaultRandom().primaryKey(),
overlayId: uuid("overlay_id")
.notNull()
.references(() => overlaysTable.id, { onDelete: "cascade" }),
clipId: varchar("clip_id").notNull(),
});export const overlaysTable = pgTable("overlays", {
id: uuid("id").notNull().defaultRandom().primaryKey(),
ownerId: varchar("owner_id")
.notNull()
.references(() => usersTable.id, { onDelete: "cascade" }),
name: varchar("name").notNull(),
status: varchar("status").$type<StatusOptions>().notNull(),
type: varchar("type").$type<OverlayType>().notNull(),
rewardId: varchar("reward_id"),
});
export const queTable = pgTable("clipQue", {
id: uuid("id").notNull().defaultRandom().primaryKey(),
overlayId: uuid("overlay_id")
.notNull()
.references(() => overlaysTable.id, { onDelete: "cascade" }),
clipId: varchar("clip_id").notNull(),
});When I try to push this I get
error: column "id" cannot be cast automatically to type uuiderror: column "id" cannot be cast automatically to type uuid