Rebrand to Syncfuse

This commit is contained in:
DinuraSellapperuma 2026-02-12 14:09:22 +05:30
parent 0a09df5470
commit 92025c9dba
144 changed files with 1796 additions and 1977 deletions

View file

@ -9,10 +9,10 @@ ALTER TABLE "website_event" ADD COLUMN "job_id" UUID AFTER "created_at";
ALTER TABLE "event_data" ADD COLUMN "job_id" UUID AFTER "created_at";
-- update event_data string
alter table umami.event_data
alter table syncfuse.event_data
update string_value = number_value
where data_type = 2
alter table umami.event_data
alter table syncfuse.event_data
update string_value = replaceOne(concat(CAST(toDateTime(date_value, 'UTC'), 'String'),'Z'), ' ', 'T')
where data_type = 4

View file

@ -1,4 +1,4 @@
CREATE TABLE umami.website_event_join
CREATE TABLE syncfuse.website_event_join
(
session_id UUID,
visit_id UUID,
@ -8,7 +8,7 @@ CREATE TABLE umami.website_event_join
ORDER BY (session_id, created_at)
SETTINGS index_granularity = 8192;
INSERT INTO umami.website_event_join
INSERT INTO syncfuse.website_event_join
SELECT DISTINCT
s.session_id,
generateUUIDv4() visit_id,
@ -18,7 +18,7 @@ FROM (SELECT DISTINCT session_id,
FROM website_event) s;
-- create new table
CREATE TABLE umami.website_event_new
CREATE TABLE syncfuse.website_event_new
(
website_id UUID,
session_id UUID,
@ -49,7 +49,7 @@ CREATE TABLE umami.website_event_new
ORDER BY (website_id, session_id, created_at)
SETTINGS index_granularity = 8192;
INSERT INTO umami.website_event_new
INSERT INTO syncfuse.website_event_new
SELECT we.website_id,
we.session_id,
j.visit_id,
@ -74,17 +74,17 @@ SELECT we.website_id,
we.event_name,
we.created_at,
we.job_id
FROM umami.website_event we
JOIN umami.website_event_join j
FROM syncfuse.website_event we
JOIN syncfuse.website_event_join j
ON we.session_id = j.session_id
and date_trunc('hour', we.created_at) = j.created_at
RENAME TABLE umami.website_event TO umami.website_event_old;
RENAME TABLE umami.website_event_new TO umami.website_event;
RENAME TABLE syncfuse.website_event TO syncfuse.website_event_old;
RENAME TABLE syncfuse.website_event_new TO syncfuse.website_event;
/*
DROP TABLE umami.website_event_old
DROP TABLE umami.website_event_join
DROP TABLE syncfuse.website_event_old
DROP TABLE syncfuse.website_event_join
*/

View file

@ -1,4 +1,4 @@
CREATE TABLE umami.event_data_new
CREATE TABLE syncfuse.event_data_new
(
website_id UUID,
session_id UUID,
@ -17,7 +17,7 @@ CREATE TABLE umami.event_data_new
ORDER BY (website_id, event_id, data_key, created_at)
SETTINGS index_granularity = 8192;
INSERT INTO umami.event_data_new
INSERT INTO syncfuse.event_data_new
SELECT website_id,
session_id,
event_id,
@ -30,9 +30,9 @@ SELECT website_id,
data_type,
created_at,
NULL
FROM umami.event_data;
FROM syncfuse.event_data;
CREATE TABLE umami.session_data
CREATE TABLE syncfuse.session_data
(
website_id UUID,
session_id UUID,
@ -48,10 +48,10 @@ CREATE TABLE umami.session_data
ORDER BY (website_id, session_id, data_key, created_at)
SETTINGS index_granularity = 8192;
RENAME TABLE umami.event_data TO umami.event_data_old;
RENAME TABLE umami.event_data_new TO umami.event_data;
RENAME TABLE syncfuse.event_data TO syncfuse.event_data_old;
RENAME TABLE syncfuse.event_data_new TO syncfuse.event_data;
/*
DROP TABLE umami.event_data_old
DROP TABLE syncfuse.event_data_old
*/

View file

@ -1,12 +1,12 @@
-- add tag column
ALTER TABLE umami.website_event ADD COLUMN "tag" String AFTER "event_name";
ALTER TABLE umami.website_event_stats_hourly ADD COLUMN "tag" SimpleAggregateFunction(groupArrayArray, Array(String)) AFTER "max_time";
ALTER TABLE syncfuse.website_event ADD COLUMN "tag" String AFTER "event_name";
ALTER TABLE syncfuse.website_event_stats_hourly ADD COLUMN "tag" SimpleAggregateFunction(groupArrayArray, Array(String)) AFTER "max_time";
-- update materialized view
DROP TABLE umami.website_event_stats_hourly_mv;
DROP TABLE syncfuse.website_event_stats_hourly_mv;
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
TO umami.website_event_stats_hourly
CREATE MATERIALIZED VIEW syncfuse.website_event_stats_hourly_mv
TO syncfuse.website_event_stats_hourly
AS
SELECT
website_id,
@ -60,7 +60,7 @@ FROM (SELECT
max(created_at) max_time,
arrayFilter(x -> x != '', groupArray(tag)) tag,
toStartOfHour(created_at) timestamp
FROM umami.website_event
FROM syncfuse.website_event
GROUP BY website_id,
session_id,
visit_id,

View file

@ -1,5 +1,5 @@
-- Create Event
CREATE TABLE umami.website_event_new
CREATE TABLE syncfuse.website_event_new
(
website_id UUID,
session_id UUID,
@ -49,7 +49,7 @@ ENGINE = MergeTree
SETTINGS index_granularity = 8192;
-- stats hourly
CREATE TABLE umami.website_event_stats_hourly_new
CREATE TABLE syncfuse.website_event_stats_hourly_new
(
website_id UUID,
session_id UUID,
@ -99,8 +99,8 @@ ENGINE = AggregatingMergeTree
)
SAMPLE BY cityHash64(visit_id);
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv_new
TO umami.website_event_stats_hourly_new
CREATE MATERIALIZED VIEW syncfuse.website_event_stats_hourly_mv_new
TO syncfuse.website_event_stats_hourly_new
AS
SELECT
website_id,
@ -176,7 +176,7 @@ FROM (SELECT
max(created_at) max_time,
arrayFilter(x -> x != '', groupArray(tag)) tag,
toStartOfHour(created_at) timestamp
FROM umami.website_event_new
FROM syncfuse.website_event_new
GROUP BY website_id,
session_id,
visit_id,
@ -193,22 +193,22 @@ GROUP BY website_id,
timestamp);
-- projections
ALTER TABLE umami.website_event_new
ALTER TABLE syncfuse.website_event_new
ADD PROJECTION website_event_url_path_projection (
SELECT * ORDER BY toStartOfDay(created_at), website_id, url_path, created_at
);
ALTER TABLE umami.website_event_new MATERIALIZE PROJECTION website_event_url_path_projection;
ALTER TABLE syncfuse.website_event_new MATERIALIZE PROJECTION website_event_url_path_projection;
ALTER TABLE umami.website_event_new
ALTER TABLE syncfuse.website_event_new
ADD PROJECTION website_event_referrer_domain_projection (
SELECT * ORDER BY toStartOfDay(created_at), website_id, referrer_domain, created_at
);
ALTER TABLE umami.website_event_new MATERIALIZE PROJECTION website_event_referrer_domain_projection;
ALTER TABLE syncfuse.website_event_new MATERIALIZE PROJECTION website_event_referrer_domain_projection;
-- migration
INSERT INTO umami.website_event_new
INSERT INTO syncfuse.website_event_new
SELECT website_id, session_id, visit_id, event_id, hostname, browser, os, device, screen, language, country, subdivision1, subdivision2, city, url_path, url_query,
extract(url_query, 'utm_source=([^&]*)') AS utm_source,
extract(url_query, 'utm_medium=([^&]*)') AS utm_medium,
@ -223,23 +223,23 @@ SELECT website_id, session_id, visit_id, event_id, hostname, browser, os, device
extract(url_query, 'li_fat_id=([^&]*)') li_fat_id,
extract(url_query, 'twclid=([^&]*)') twclid,
event_type, event_name, tag, created_at, job_id
FROM umami.website_event
FROM syncfuse.website_event
-- rename tables
RENAME TABLE umami.website_event TO umami.website_event_old;
RENAME TABLE umami.website_event_new TO umami.website_event;
RENAME TABLE syncfuse.website_event TO syncfuse.website_event_old;
RENAME TABLE syncfuse.website_event_new TO syncfuse.website_event;
RENAME TABLE umami.website_event_stats_hourly TO umami.website_event_stats_hourly_old;
RENAME TABLE umami.website_event_stats_hourly_new TO umami.website_event_stats_hourly;
RENAME TABLE syncfuse.website_event_stats_hourly TO syncfuse.website_event_stats_hourly_old;
RENAME TABLE syncfuse.website_event_stats_hourly_new TO syncfuse.website_event_stats_hourly;
RENAME TABLE umami.website_event_stats_hourly_mv TO umami.website_event_stats_hourly_mv_old;
RENAME TABLE umami.website_event_stats_hourly_mv_new TO umami.website_event_stats_hourly_mv;
RENAME TABLE syncfuse.website_event_stats_hourly_mv TO syncfuse.website_event_stats_hourly_mv_old;
RENAME TABLE syncfuse.website_event_stats_hourly_mv_new TO syncfuse.website_event_stats_hourly_mv;
-- recreate view
DROP TABLE umami.website_event_stats_hourly_mv;
DROP TABLE syncfuse.website_event_stats_hourly_mv;
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
TO umami.website_event_stats_hourly
CREATE MATERIALIZED VIEW syncfuse.website_event_stats_hourly_mv
TO syncfuse.website_event_stats_hourly
AS
SELECT
website_id,
@ -315,7 +315,7 @@ FROM (SELECT
max(created_at) max_time,
arrayFilter(x -> x != '', groupArray(tag)) tag,
toStartOfHour(created_at) timestamp
FROM umami.website_event
FROM syncfuse.website_event
GROUP BY website_id,
session_id,
visit_id,

View file

@ -1,35 +1,35 @@
-- drop projections
ALTER TABLE umami.website_event DROP PROJECTION website_event_url_path_projection;
ALTER TABLE umami.website_event DROP PROJECTION website_event_referrer_domain_projection;
ALTER TABLE syncfuse.website_event DROP PROJECTION website_event_url_path_projection;
ALTER TABLE syncfuse.website_event DROP PROJECTION website_event_referrer_domain_projection;
--drop view
DROP TABLE umami.website_event_stats_hourly_mv;
DROP TABLE syncfuse.website_event_stats_hourly_mv;
-- rename columns
ALTER TABLE umami.website_event RENAME COLUMN "subdivision1" TO "region";
ALTER TABLE umami.website_event_stats_hourly RENAME COLUMN "subdivision1" TO "region";
ALTER TABLE syncfuse.website_event RENAME COLUMN "subdivision1" TO "region";
ALTER TABLE syncfuse.website_event_stats_hourly RENAME COLUMN "subdivision1" TO "region";
-- drop columns
ALTER TABLE umami.website_event DROP COLUMN "subdivision2";
ALTER TABLE syncfuse.website_event DROP COLUMN "subdivision2";
-- recreate projections
ALTER TABLE umami.website_event
ALTER TABLE syncfuse.website_event
ADD PROJECTION website_event_url_path_projection (
SELECT * ORDER BY toStartOfDay(created_at), website_id, url_path, created_at
);
ALTER TABLE umami.website_event MATERIALIZE PROJECTION website_event_url_path_projection;
ALTER TABLE syncfuse.website_event MATERIALIZE PROJECTION website_event_url_path_projection;
ALTER TABLE umami.website_event
ALTER TABLE syncfuse.website_event
ADD PROJECTION website_event_referrer_domain_projection (
SELECT * ORDER BY toStartOfDay(created_at), website_id, referrer_domain, created_at
);
ALTER TABLE umami.website_event MATERIALIZE PROJECTION website_event_referrer_domain_projection;
ALTER TABLE syncfuse.website_event MATERIALIZE PROJECTION website_event_referrer_domain_projection;
-- recreate view
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
TO umami.website_event_stats_hourly
CREATE MATERIALIZED VIEW syncfuse.website_event_stats_hourly_mv
TO syncfuse.website_event_stats_hourly
AS
SELECT
website_id,
@ -105,7 +105,7 @@ FROM (SELECT
max(created_at) max_time,
arrayFilter(x -> x != '', groupArray(tag)) tag,
toStartOfHour(created_at) timestamp
FROM umami.website_event
FROM syncfuse.website_event
GROUP BY website_id,
session_id,
visit_id,

View file

@ -1,13 +1,13 @@
-- add tag column
ALTER TABLE umami.website_event ADD COLUMN "distinct_id" String AFTER "tag";
ALTER TABLE umami.website_event_stats_hourly ADD COLUMN "distinct_id" String AFTER "tag";
ALTER TABLE umami.session_data ADD COLUMN "distinct_id" String AFTER "data_type";
ALTER TABLE syncfuse.website_event ADD COLUMN "distinct_id" String AFTER "tag";
ALTER TABLE syncfuse.website_event_stats_hourly ADD COLUMN "distinct_id" String AFTER "tag";
ALTER TABLE syncfuse.session_data ADD COLUMN "distinct_id" String AFTER "data_type";
-- update materialized view
DROP TABLE umami.website_event_stats_hourly_mv;
DROP TABLE syncfuse.website_event_stats_hourly_mv;
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
TO umami.website_event_stats_hourly
CREATE MATERIALIZED VIEW syncfuse.website_event_stats_hourly_mv
TO syncfuse.website_event_stats_hourly
AS
SELECT
website_id,
@ -85,7 +85,7 @@ FROM (SELECT
arrayFilter(x -> x != '', groupArray(tag)) tag,
distinct_id,
toStartOfHour(created_at) timestamp
FROM umami.website_event
FROM syncfuse.website_event
GROUP BY website_id,
session_id,
visit_id,

View file

@ -1,5 +1,5 @@
-- create new hourly table
CREATE TABLE umami.website_event_stats_hourly_new
CREATE TABLE syncfuse.website_event_stats_hourly_new
(
website_id UUID,
session_id UUID,
@ -51,8 +51,8 @@ ENGINE = AggregatingMergeTree
SAMPLE BY cityHash64(visit_id);
-- create view
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv_new
TO umami.website_event_stats_hourly_new
CREATE MATERIALIZED VIEW syncfuse.website_event_stats_hourly_mv_new
TO syncfuse.website_event_stats_hourly_new
AS
SELECT
website_id,
@ -130,7 +130,7 @@ FROM (SELECT
arrayFilter(x -> x != '', groupArray(tag)) tag,
distinct_id,
toStartOfHour(created_at) timestamp
FROM umami.website_event
FROM syncfuse.website_event
GROUP BY website_id,
session_id,
visit_id,
@ -148,16 +148,16 @@ GROUP BY website_id,
timestamp);
-- rename tables
RENAME TABLE umami.website_event_stats_hourly TO umami.website_event_stats_hourly_old;
RENAME TABLE umami.website_event_stats_hourly_new TO umami.website_event_stats_hourly;
RENAME TABLE syncfuse.website_event_stats_hourly TO syncfuse.website_event_stats_hourly_old;
RENAME TABLE syncfuse.website_event_stats_hourly_new TO syncfuse.website_event_stats_hourly;
-- drop views
DROP TABLE umami.website_event_stats_hourly_mv;
DROP TABLE umami.website_event_stats_hourly_mv_new;
DROP TABLE syncfuse.website_event_stats_hourly_mv;
DROP TABLE syncfuse.website_event_stats_hourly_mv_new;
-- recreate view
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
TO umami.website_event_stats_hourly
CREATE MATERIALIZED VIEW syncfuse.website_event_stats_hourly_mv
TO syncfuse.website_event_stats_hourly
AS
SELECT
website_id,
@ -235,7 +235,7 @@ FROM (SELECT
arrayFilter(x -> x != '', groupArray(tag)) tag,
distinct_id,
toStartOfHour(created_at) timestamp
FROM umami.website_event
FROM syncfuse.website_event
GROUP BY website_id,
session_id,
visit_id,

View file

@ -1,5 +1,5 @@
-- Create Event
CREATE TABLE umami.website_event
CREATE TABLE syncfuse.website_event
(
website_id UUID,
session_id UUID,
@ -48,7 +48,7 @@ ENGINE = MergeTree
PRIMARY KEY (toStartOfHour(created_at), website_id, session_id, visit_id)
SETTINGS index_granularity = 8192;
CREATE TABLE umami.event_data
CREATE TABLE syncfuse.event_data
(
website_id UUID,
session_id UUID,
@ -67,7 +67,7 @@ ENGINE = MergeTree
ORDER BY (website_id, event_id, data_key, created_at)
SETTINGS index_granularity = 8192;
CREATE TABLE umami.session_data
CREATE TABLE syncfuse.session_data
(
website_id UUID,
session_id UUID,
@ -85,7 +85,7 @@ ENGINE = ReplacingMergeTree
SETTINGS index_granularity = 8192;
-- stats hourly
CREATE TABLE umami.website_event_stats_hourly
CREATE TABLE syncfuse.website_event_stats_hourly
(
website_id UUID,
session_id UUID,
@ -136,8 +136,8 @@ ENGINE = AggregatingMergeTree
)
SAMPLE BY cityHash64(visit_id);
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
TO umami.website_event_stats_hourly
CREATE MATERIALIZED VIEW syncfuse.website_event_stats_hourly_mv
TO syncfuse.website_event_stats_hourly
AS
SELECT
website_id,
@ -215,7 +215,7 @@ FROM (SELECT
arrayFilter(x -> x != '', groupArray(tag)) tag,
distinct_id,
toStartOfHour(created_at) timestamp
FROM umami.website_event
FROM syncfuse.website_event
GROUP BY website_id,
session_id,
visit_id,
@ -233,22 +233,22 @@ GROUP BY website_id,
timestamp);
-- projections
ALTER TABLE umami.website_event
ALTER TABLE syncfuse.website_event
ADD PROJECTION website_event_url_path_projection (
SELECT * ORDER BY toStartOfDay(created_at), website_id, url_path, created_at
);
ALTER TABLE umami.website_event MATERIALIZE PROJECTION website_event_url_path_projection;
ALTER TABLE syncfuse.website_event MATERIALIZE PROJECTION website_event_url_path_projection;
ALTER TABLE umami.website_event
ALTER TABLE syncfuse.website_event
ADD PROJECTION website_event_referrer_domain_projection (
SELECT * ORDER BY toStartOfDay(created_at), website_id, referrer_domain, created_at
);
ALTER TABLE umami.website_event MATERIALIZE PROJECTION website_event_referrer_domain_projection;
ALTER TABLE syncfuse.website_event MATERIALIZE PROJECTION website_event_referrer_domain_projection;
-- revenue
CREATE TABLE umami.website_revenue
CREATE TABLE syncfuse.website_revenue
(
website_id UUID,
session_id UUID,
@ -264,8 +264,8 @@ ENGINE = MergeTree
SETTINGS index_granularity = 8192;
CREATE MATERIALIZED VIEW umami.website_revenue_mv
TO umami.website_revenue
CREATE MATERIALIZED VIEW syncfuse.website_revenue_mv
TO syncfuse.website_revenue
AS
SELECT DISTINCT
ed.website_id,
@ -275,9 +275,9 @@ SELECT DISTINCT
c.currency,
coalesce(toDecimal64(ed.number_value, 2), toDecimal64(ed.string_value, 2)) revenue,
ed.created_at
FROM umami.event_data ed
FROM syncfuse.event_data ed
JOIN (SELECT event_id, string_value as currency
FROM umami.event_data
FROM syncfuse.event_data
WHERE positionCaseInsensitive(data_key, 'currency') > 0) c
ON c.event_id = ed.event_id
WHERE positionCaseInsensitive(data_key, 'revenue') > 0;