Skip to content

Commit

Permalink
feat(DB): added screen_width & screen_height (openreplay#2054)
Browse files Browse the repository at this point in the history
  • Loading branch information
tahayk authored Apr 8, 2024
1 parent bb09e59 commit e4c120b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
6 changes: 5 additions & 1 deletion ee/scripts/schema/db/init_dbs/clickhouse/1.18.0/1.18.0.sql
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
CREATE OR REPLACE FUNCTION openreplay_version AS() -> 'v1.18.0-ee';
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);
10 changes: 6 additions & 4 deletions ee/scripts/schema/db/init_dbs/clickhouse/create/init_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion ee/scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions scripts/schema/db/init_dbs/postgresql/1.18.0/1.18.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/schema/db/init_dbs/postgresql/init_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e4c120b

Please sign in to comment.