Compare commits

...

3 commits

Author SHA1 Message Date
Francis Cao
1825524e95 convert report type before data migratino
Some checks are pending
Node.js CI / build (postgresql, 18.18) (push) Waiting to run
2025-09-10 09:29:49 -07:00
Francis Cao
54437ee9b8 Merge branch 'dev' of https://github.com/umami-software/umami into dev 2025-09-10 09:21:35 -07:00
Francis Cao
964651bad3 add data migration to convert funnel and goals reports to new structure 2025-09-10 09:21:27 -07:00
2 changed files with 26 additions and 0 deletions

View file

@ -71,3 +71,28 @@ CREATE INDEX "pixel_team_id_idx" ON "pixel"("team_id");
-- CreateIndex
CREATE INDEX "pixel_created_at_idx" ON "pixel"("created_at");
-- DataMigration
UPDATE "report" SET parameters = parameters - 'websiteId' - 'dateRange' WHERE type = 'funnel';
UPDATE "report" SET type = 'goal' WHERE type = 'goals';
INSERT INTO "report" (report_id, user_id, website_id, type, name, description, parameters, created_at, updated_at)
SELECT gen_random_uuid(),
user_id,
website_id,
'goal',
concat(name, ' - ', elem ->> 'value'),
description,
jsonb_build_object(
'type', CASE WHEN elem ->> 'type' = 'url' THEN 'path'
ELSE elem ->> 'type' END,
'value', elem ->> 'value'
) AS parameters,
created_at,
updated_at
FROM "report"
CROSS JOIN LATERAL jsonb_array_elements(parameters -> 'goals') elem
WHERE elem ->> 'type' IN ('event', 'url')
and type = 'goal';
DELETE FROM "report" WHERE parameters ? 'goals' and type = 'goal';

View file

@ -59,6 +59,7 @@ export {
Funnel,
Lightbulb,
Lightning,
Location,
Magnet,
Money,
Network,