Spaces:
Running
Running
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; |