Guardian-Agent / lib /db /src /schema /messages.ts
subisfoodandtas
Add dark pattern detection and reporting features to the Guardian Agent
2211d3a
Raw
History Blame Contribute Delete
799 Bytes
import { integer, pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
import { createInsertSchema } from "drizzle-zod";
import { z } from "zod/v4";
import { conversations } from "./conversations";
export const messages = pgTable("messages", {
id: serial("id").primaryKey(),
conversationId: integer("conversation_id")
.notNull()
.references(() => conversations.id, { onDelete: "cascade" }),
role: text("role").notNull(),
content: text("content").notNull(),
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
});
export const insertMessageSchema = createInsertSchema(messages).omit({
id: true,
createdAt: true,
});
export type Message = typeof messages.$inferSelect;
export type InsertMessage = z.infer<typeof insertMessageSchema>;