From 7d0da34546b089bb3a532e1a24f98eb5d2cf8f69 Mon Sep 17 00:00:00 2001 From: Forgemind Date: Sun, 18 Oct 2026 12:36:49 +0000 Subject: [PATCH] Fix migration 131 on installs where 094 left automation_folders behind On an install whose boot-time ensureProjectTables() created `projects` before migration 094 ran, 094 could not rename automation_folders and left it in place with chatbots.folder_id still pointing at it. 131's DROP TABLE then failed on that foreign key, the migration runner stopped, and the backend crash-looped. Drop the unused folder_id column first. Found deploying the previous release to the demo. Co-Authored-By: Claude Opus 5.5 --- supabase/migrations/131_remove_forms_projects.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/supabase/migrations/131_remove_forms_projects.sql b/supabase/migrations/131_remove_forms_projects.sql index edf4d16..9f81d14 100644 --- a/supabase/migrations/131_remove_forms_projects.sql +++ b/supabase/migrations/131_remove_forms_projects.sql @@ -42,7 +42,11 @@ ALTER TABLE coexistence.chatbots DROP COLUMN IF EXISTS project_id; ALTER TABLE coexistence.message_templates DROP COLUMN IF EXISTS project_id; ALTER TABLE coexistence.agents DROP COLUMN IF EXISTS project_id; DROP TABLE IF EXISTS coexistence.projects; --- automation_folders was renamed to projects by 094; drop a leftover too. +-- automation_folders was renamed to projects by 094 — unless the boot-time +-- ensureProjectTables() had already created `projects`, in which case 094 left +-- both tables and chatbots.folder_id still points at the old one. Drop that +-- column (unused since 094) first, or the DROP TABLE fails on its foreign key. +ALTER TABLE coexistence.chatbots DROP COLUMN IF EXISTS folder_id; DROP TABLE IF EXISTS coexistence.automation_folders; -- Page keys -------------------------------------------------------------------