- Introduced `bot_id` column in `system_automations` table (migration 6.0.0.sql) and updated the Diesel schema/model to include it. - Adjusted migrations to remove the hard‑coded “Update Summary” automation and only create an index on the `name` column. - Extended the `SET_SCHEDULE` keyword: - Added a second string argument for the script name. - Passed the invoking user's `bot_id` to the database layer. - Updated function signature to accept a full `UserSession` instead of discarding it. - Modified `execute_set_schedule` to store `bot_id`, script name, and activation flag; added conflict handling on `(bot_id, param)` to update schedule and reset trigger state. - Updated imports and logging to reflect new parameters. These changes enable per‑bot automation management, allow specifying the script to run, and improve idempotent schedule updates.
10 lines
582 B
SQL
10 lines
582 B
SQL
-- Migration 6.0.5: Add update-summary.bas scheduled automation
|
|
-- Description: Creates a scheduled automation that runs every minute to update summaries
|
|
-- This replaces the announcements system in legacy mode
|
|
-- Note: Bots are now created dynamically during bootstrap based on template folders
|
|
|
|
-- Add name column to system_automations if it doesn't exist
|
|
ALTER TABLE public.system_automations ADD COLUMN IF NOT EXISTS name VARCHAR(255);
|
|
|
|
-- Create index on name column for faster lookups
|
|
CREATE INDEX IF NOT EXISTS idx_system_automations_name ON public.system_automations(name);
|