fix(migration): remap firecrawl rows in the down migration

The down migration narrows the searchengine_type enum by casting the
engine column to a new enum that no longer contains 'firecrawl'. Any row
logged with 'firecrawl' would make that cast fail, so a rollback errors out
once the engine has been used. Remap those rows to 'tavily' before the cast
so the down migration is safe on real data.
This commit is contained in:
rramprakash
2026-07-16 12:53:11 +05:30
parent b32dde8f01
commit 4245be118a
@@ -40,6 +40,12 @@ CREATE TYPE SEARCHENGINE_TYPE_NEW AS ENUM (
'sploitus'
);
-- Remap any rows logged with the removed value so the narrowing cast below
-- cannot fail; 'firecrawl' is a content-rich search engine like 'tavily'.
UPDATE searchlogs
SET engine = 'tavily'
WHERE engine = 'firecrawl';
-- Update the searchlogs table to use the reverted enum type
ALTER TABLE searchlogs
ALTER COLUMN engine TYPE SEARCHENGINE_TYPE_NEW USING engine::text::SEARCHENGINE_TYPE_NEW;