CREATE TABLE "chats" ( "id" text PRIMARY KEY NOT NULL, "title" text DEFAULT 'New Chat' NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL, "updated_at" timestamp DEFAULT now() NOT NULL ); --> statement-breakpoint CREATE TABLE "messages" ( "id" text PRIMARY KEY NOT NULL, "chat_id" text NOT NULL, "content" text NOT NULL, "role" text NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL ); --> statement-breakpoint ALTER TABLE "messages" ADD CONSTRAINT "messages_chat_id_chats_id_fk" FOREIGN KEY ("chat_id") REFERENCES "public"."chats"("id") ON DELETE cascade ON UPDATE no action;