mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-08-24 12:06:36 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user