serene-pub/drizzle/0063_large_red_shift.sql
2026-07-16 23:46:20 -07:00

16 lines
No EOL
1.8 KiB
SQL

CREATE TABLE "chat_world_prompt_configs" (
"id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "chat_world_prompt_configs_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"is_immutable" boolean DEFAULT false NOT NULL,
"name" text NOT NULL,
"system_prompt" text NOT NULL,
"connection_id" integer,
"sampling_config_id" integer
);
--> statement-breakpoint
ALTER TABLE "chat_messages" ADD COLUMN "is_world_response" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "system_settings" ADD COLUMN "default_chat_world_prompt_config_id" integer;--> statement-breakpoint
ALTER TABLE "user_settings" ADD COLUMN "active_chat_world_prompt_config_id" integer;--> statement-breakpoint
ALTER TABLE "chat_world_prompt_configs" ADD CONSTRAINT "chat_world_prompt_configs_connection_id_connections_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."connections"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "chat_world_prompt_configs" ADD CONSTRAINT "chat_world_prompt_configs_sampling_config_id_sampling_configs_id_fk" FOREIGN KEY ("sampling_config_id") REFERENCES "public"."sampling_configs"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "system_settings" ADD CONSTRAINT "system_settings_default_chat_world_prompt_config_id_chat_world_prompt_configs_id_fk" FOREIGN KEY ("default_chat_world_prompt_config_id") REFERENCES "public"."chat_world_prompt_configs"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "user_settings" ADD CONSTRAINT "user_settings_active_chat_world_prompt_config_id_chat_world_prompt_configs_id_fk" FOREIGN KEY ("active_chat_world_prompt_config_id") REFERENCES "public"."chat_world_prompt_configs"("id") ON DELETE set null ON UPDATE no action;