From 0a45a96facb334f9e4899715018c4d8f81d3f03d Mon Sep 17 00:00:00 2001 From: Steve Munene Date: Tue, 3 Mar 2026 17:33:58 +0300 Subject: [PATCH] NOISSUE - Update Rules metadata migrations (#421) Signed-off-by: nyagamunene --- re/postgres/init.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/re/postgres/init.go b/re/postgres/init.go index 99eb347ff..f01e63336 100644 --- a/re/postgres/init.go +++ b/re/postgres/init.go @@ -50,6 +50,19 @@ func Migration() *migrate.MemoryMigrationSource { `ALTER TABLE rules DROP COLUMN tags;`, }, }, + { + Id: "rules_03", + Up: []string{ + `UPDATE rules + SET metadata = (COALESCE(metadata, '{}'::jsonb) - 'ui') || jsonb_build_object('flow', metadata->'ui') + WHERE metadata ? 'ui' AND jsonb_typeof(metadata->'ui') = 'object'`, + }, + Down: []string{ + `UPDATE rules + SET metadata = (COALESCE(metadata, '{}'::jsonb) - 'flow') || jsonb_build_object('ui', metadata->'flow') + WHERE metadata ? 'flow' AND jsonb_typeof(metadata->'flow') = 'object'`, + }, + }, }, } }