diff --git a/ee/scripts/schema/db/init_dbs/clickhouse/1.18.0/1.18.0.sql b/ee/scripts/schema/db/init_dbs/clickhouse/1.18.0/1.18.0.sql index 54d88f4e39..dfee120dc1 100644 --- a/ee/scripts/schema/db/init_dbs/clickhouse/1.18.0/1.18.0.sql +++ b/ee/scripts/schema/db/init_dbs/clickhouse/1.18.0/1.18.0.sql @@ -1 +1,5 @@ -CREATE OR REPLACE FUNCTION openreplay_version AS() -> 'v1.18.0-ee'; \ No newline at end of file +CREATE OR REPLACE FUNCTION openreplay_version AS() -> 'v1.18.0-ee'; + +ALTER TABLE experimental.sessions + ADD COLUMN IF NOT EXISTS screen_width Nullable(Int16), + ADD COLUMN IF NOT EXISTS screen_height Nullable(Int16); \ No newline at end of file diff --git a/ee/scripts/schema/db/init_dbs/clickhouse/create/init_schema.sql b/ee/scripts/schema/db/init_dbs/clickhouse/create/init_schema.sql index fb6fa6f203..629b7ee6b9 100644 --- a/ee/scripts/schema/db/init_dbs/clickhouse/create/init_schema.sql +++ b/ee/scripts/schema/db/init_dbs/clickhouse/create/init_schema.sql @@ -144,6 +144,12 @@ CREATE TABLE IF NOT EXISTS experimental.sessions utm_campaign Nullable(String), user_id Nullable(String), user_anonymous_id Nullable(String), + issue_types Array(LowCardinality(String)), + referrer Nullable(String), + base_referrer Nullable(String) MATERIALIZED lower(concat(domain(referrer), path(referrer))), + issue_score Nullable(UInt32), + screen_width Nullable(Int16), + screen_height Nullable(Int16), metadata_1 Nullable(String), metadata_2 Nullable(String), metadata_3 Nullable(String), @@ -154,10 +160,6 @@ CREATE TABLE IF NOT EXISTS experimental.sessions metadata_8 Nullable(String), metadata_9 Nullable(String), metadata_10 Nullable(String), - issue_types Array(LowCardinality(String)), - referrer Nullable(String), - base_referrer Nullable(String) MATERIALIZED lower(concat(domain(referrer), path(referrer))), - issue_score Nullable(UInt32), _timestamp DateTime DEFAULT now() ) ENGINE = ReplacingMergeTree(_timestamp) PARTITION BY toYYYYMMDD(datetime) diff --git a/ee/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql b/ee/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql index 92ae1a162a..79ed9826bf 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql @@ -19,9 +19,13 @@ $fn_def$, :'next_version') -- DROP FUNCTION IF EXISTS events.funnel(steps integer[], m integer); -ALTER TABLE public.assist_records +ALTER TABLE IF EXISTS public.assist_records ALTER COLUMN session_id DROP NOT NULL; +ALTER TABLE IF EXISTS public.sessions + ADD COLUMN IF NOT EXISTS screen_width integer DEFAULT NULL, + ADD COLUMN IF NOT EXISTS screen_height integer DEFAULT NULL; + COMMIT; \elif :is_next diff --git a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql index 97b7de2ef4..0a8fa6ed28 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -442,6 +442,8 @@ CREATE TABLE public.sessions base_referrer text NULL DEFAULT NULL, file_key bytea DEFAULT NULL, has_ut_test boolean DEFAULT FALSE, + screen_width integer DEFAULT NULL, + screen_height integer DEFAULT NULL, metadata_1 text DEFAULT NULL, metadata_2 text DEFAULT NULL, metadata_3 text DEFAULT NULL, diff --git a/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql b/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql index dc3af11ab7..f9a5639bad 100644 --- a/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql +++ b/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql @@ -20,6 +20,10 @@ $fn_def$, :'next_version') -- DROP FUNCTION IF EXISTS events.funnel(steps integer[], m integer); +ALTER TABLE IF EXISTS public.sessions + ADD COLUMN IF NOT EXISTS screen_width integer DEFAULT NULL, + ADD COLUMN IF NOT EXISTS screen_height integer DEFAULT NULL; + COMMIT; \elif :is_next diff --git a/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/scripts/schema/db/init_dbs/postgresql/init_schema.sql index 24ab066de4..6b2f68bec5 100644 --- a/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -403,6 +403,8 @@ CREATE TABLE public.sessions referrer text NULL DEFAULT NULL, base_referrer text NULL DEFAULT NULL, has_ut_test boolean DEFAULT FALSE, + screen_width integer DEFAULT NULL, + screen_height integer DEFAULT NULL, metadata_1 text DEFAULT NULL, metadata_2 text DEFAULT NULL, metadata_3 text DEFAULT NULL,