5414
Sa
sat / files
sat / drizzle / 0000_handy_kang.sql
699 bytes
1CREATE TABLE "conversations" ( 2 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, 3 "title" text, 4 "created_at" timestamp DEFAULT now() NOT NULL, 5 "updated_at" timestamp DEFAULT now() NOT NULL 6); 7--> statement-breakpoint 8CREATE TABLE "turns" ( 9 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, 10 "conversation_id" uuid NOT NULL, 11 "role" text NOT NULL, 12 "content" text NOT NULL, 13 "reasoning" text, 14 "tool_calls" jsonb, 15 "created_at" timestamp DEFAULT now() NOT NULL 16); 17--> statement-breakpoint 18ALTER TABLE "turns" ADD CONSTRAINT "turns_conversation_id_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."conversations"("id") ON DELETE cascade ON UPDATE no action;