diff --git a/migrations/6.0.5.sql b/migrations/6.0.5.sql index 84a26245..eceac51b 100644 --- a/migrations/6.0.5.sql +++ b/migrations/6.0.5.sql @@ -44,3 +44,35 @@ BEGIN END IF; END $$; + +-- Migration 6.0.6: Add unique constraint for system_automations +-- Fixes error: "there is no unique or exclusion constraint matching the ON CONFLICT specification" + +ALTER TABLE public.system_automations +ADD CONSTRAINT system_automations_bot_kind_param_unique +UNIQUE (bot_id, kind, param); + +-- Add index for the new constraint +CREATE INDEX IF NOT EXISTS idx_system_automations_bot_kind_param +ON public.system_automations (bot_id, kind, param); + + +-- Migration 6.0.7: Fix clicks table primary key +-- Required by Diesel before we can run other migrations + +-- Create new table with proper structure +CREATE TABLE IF NOT EXISTS public.new_clicks ( + id SERIAL PRIMARY KEY, + campaign_id text NOT NULL, + email text NOT NULL, + updated_at timestamptz DEFAULT now() NULL, + CONSTRAINT new_clicks_campaign_id_email_key UNIQUE (campaign_id, email) +); + +-- Copy data from old table +INSERT INTO public.new_clicks (campaign_id, email, updated_at) +SELECT campaign_id, email, updated_at FROM public.clicks; + +-- Drop old table and rename new one +DROP TABLE public.clicks; +ALTER TABLE public.new_clicks RENAME TO clicks; diff --git a/migrations/6.0.6.sql b/migrations/6.0.6.sql deleted file mode 100644 index f87069b5..00000000 --- a/migrations/6.0.6.sql +++ /dev/null @@ -1,10 +0,0 @@ --- Migration 6.0.6: Add unique constraint for system_automations --- Fixes error: "there is no unique or exclusion constraint matching the ON CONFLICT specification" - -ALTER TABLE public.system_automations -ADD CONSTRAINT system_automations_bot_kind_param_unique -UNIQUE (bot_id, kind, param); - --- Add index for the new constraint -CREATE INDEX IF NOT EXISTS idx_system_automations_bot_kind_param -ON public.system_automations (bot_id, kind, param); diff --git a/migrations/6.0.7.sql b/migrations/6.0.7.sql deleted file mode 100644 index a6ff9995..00000000 --- a/migrations/6.0.7.sql +++ /dev/null @@ -1,19 +0,0 @@ --- Migration 6.0.7: Fix clicks table primary key --- Required by Diesel before we can run other migrations - --- Create new table with proper structure -CREATE TABLE IF NOT EXISTS public.new_clicks ( - id SERIAL PRIMARY KEY, - campaign_id text NOT NULL, - email text NOT NULL, - updated_at timestamptz DEFAULT now() NULL, - CONSTRAINT new_clicks_campaign_id_email_key UNIQUE (campaign_id, email) -); - --- Copy data from old table -INSERT INTO public.new_clicks (campaign_id, email, updated_at) -SELECT campaign_id, email, updated_at FROM public.clicks; - --- Drop old table and rename new one -DROP TABLE public.clicks; -ALTER TABLE public.new_clicks RENAME TO clicks; diff --git a/src/basic/keywords/llm_keyword.rs b/src/basic/keywords/llm_keyword.rs index 79392bcd..b3b8657b 100644 --- a/src/basic/keywords/llm_keyword.rs +++ b/src/basic/keywords/llm_keyword.rs @@ -6,11 +6,6 @@ use uuid::Uuid; use std::sync::Arc; use std::time::Duration; -/// Registers the `LLM` keyword for Rhai scripts. -/// Example usage inside Rhai: -/// ```rhai -/// result = LLM "Summarize the following text about AI:"; -/// ``` pub fn llm_keyword(state: Arc, _user: UserSession, engine: &mut Engine) { let state_clone = Arc::clone(&state);