-- Fix student_bot_access foreign key to use CASCADE delete instead of RESTRICT
-- This allows bots to be deleted even when they have student assignments

-- Drop the existing foreign key constraint
ALTER TABLE "student_bot_access" DROP CONSTRAINT "student_bot_access_bot_id_fkey";

-- Add the new foreign key constraint with CASCADE delete
ALTER TABLE "student_bot_access" ADD CONSTRAINT "student_bot_access_bot_id_fkey" FOREIGN KEY ("bot_id") REFERENCES "bots"("id") ON DELETE CASCADE ON UPDATE CASCADE;
