NOISSUE - Update Rules metadata migrations (#421)

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
This commit is contained in:
Steve Munene
2026-03-03 17:33:58 +03:00
committed by GitHub
parent c2afb88e79
commit 0a45a96fac
+13
View File
@@ -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'`,
},
},
},
}
}