There is not enough information to infer relation

Hello,

I am running into a issue where drizzle studio is stating that there is not enought information to infer relation "__public__.tickets.chat". Any idea why this might be?

I have the following schema:

export const tickets = pgTable("tickets", {
    id: text("id").primaryKey(),
    title: varchar("title", { length: 255 }).notNull(),
    description: text("description").notNull(),
    status: ticketStatus("status").notNull().default("awaiting"),
    createdAt: timestamp("created_at").notNull().defaultNow(),
});

export const ticketRelations = relations(tickets, ({ one, many }) => ({
    chat: one(chats),
    tickets: many(ticketsToUsers),
}));

export const chats = pgTable("chats", {
    id: text("id").primaryKey(),
    type: chatType("type").notNull(),
    ticketID: text("ticket_id").references(() => tickets.id),
    author: text("author").notNull(),
    createdAt: timestamp("created_at").notNull().defaultNow(),
});

export const chatRelations = relations(chats, ({ many }) => ({
    messages: many(chatMessages),
    members: many(chatsToUsers),
}));
Was this page helpful?