Skip to content

Commit 907a685

Browse files
committed
Update migration script.
1 parent 6ced493 commit 907a685

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/data-migrations/convert-utm-clid-columns.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ FROM (SELECT event_id, website_id, session_id,
2525
(regexp_matches(url_query, '(?:[&?]|^)utm_medium=([^&]+)', 'i'))[1] AS utm_medium,
2626
(regexp_matches(url_query, '(?:[&?]|^)utm_source=([^&]+)', 'i'))[1] AS utm_source,
2727
(regexp_matches(url_query, '(?:[&?]|^)utm_term=([^&]+)', 'i'))[1] AS utm_term
28-
FROM "website_event") url
28+
FROM "website_event"
29+
WHERE url_query IS NOT NULL) url
2930
WHERE we.event_id = url.event_id
3031
and we.session_id = url.session_id
3132
and we.website_id = url.website_id;
@@ -45,4 +46,4 @@ SET fbclid = LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REGEXP_SUBSTR(url_query, '(?:[
4546
utm_medium = LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REGEXP_SUBSTR(url_query, '(?:[&?]|^)utm_medium=[^&]+'), '=', -1), '&', 1), 255),
4647
utm_source = LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REGEXP_SUBSTR(url_query, '(?:[&?]|^)utm_source=[^&]+'), '=', -1), '&', 1), 255),
4748
utm_term = LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REGEXP_SUBSTR(url_query, '(?:[&?]|^)utm_term=[^&]+'), '=', -1), '&', 1), 255)
48-
WHERE 1 = 1;
49+
WHERE url_query IS NOT NULL;

0 commit comments

Comments
 (0)