OpenChatAI / OpenAIChatAssistant /migrations /0000_real_lenny_balinger.sql
BarBar288's picture
Upload 122 files
27127dd verified
raw
history blame contribute delete
938 Bytes
CREATE TABLE "conversations" (
"id" text PRIMARY KEY NOT NULL,
"title" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"personality" text DEFAULT 'default' NOT NULL,
"user_id" integer
);
--> statement-breakpoint
CREATE TABLE "messages" (
"id" serial PRIMARY KEY NOT NULL,
"content" text NOT NULL,
"role" text NOT NULL,
"conversation_id" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" serial PRIMARY KEY NOT NULL,
"username" text NOT NULL,
"password" text NOT NULL,
"full_name" text,
"location" text,
"interests" text[],
"profession" text,
"pets" text,
"system_context" text,
CONSTRAINT "users_username_unique" UNIQUE("username")
);
--> statement-breakpoint
ALTER TABLE "conversations" ADD CONSTRAINT "conversations_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;