* fix(chalice): fixed Math-operators validation
refactor(chalice): search for sessions that have events for heatmaps

* refactor(chalice): search for sessions that have at least 1 location event for heatmaps

* fix(chalice): fixed Math-operators validation
refactor(chalice): search for sessions that have events for heatmaps

* refactor(chalice): search for sessions that have at least 1 location event for heatmaps

* feat(chalice): autocomplete return top 10 with stats

* fix(chalice): fixed autocomplete top 10 meta-filters

* refactor(DB): added web_vitals to pages table

* refactor(DB): added session_integrations table
This commit is contained in:
Kraiem Taha Yassine 2024-10-31 16:23:52 +01:00 committed by GitHub
parent 5b5a3033d0
commit eaf762e1bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 89 additions and 36 deletions

View file

@ -23,6 +23,18 @@ UPDATE public.roles
SET permissions='{SERVICE_SESSION_REPLAY,SERVICE_DEV_TOOLS,SERVICE_ASSIST_LIVE,SERVICE_ASSIST_CALL,SERVICE_READ_NOTES}' SET permissions='{SERVICE_SESSION_REPLAY,SERVICE_DEV_TOOLS,SERVICE_ASSIST_LIVE,SERVICE_ASSIST_CALL,SERVICE_READ_NOTES}'
WHERE service_role; WHERE service_role;
ALTER TABLE IF EXISTS events.pages
ADD COLUMN IF NOT EXISTS web_vitals text DEFAULT NULL;
CREATE TABLE IF NOT EXISTS public.session_integrations
(
session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE,
project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE,
provider text NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()),
PRIMARY KEY (session_id, project_id, provider)
);
COMMIT; COMMIT;
\elif :is_next \elif :is_next

View file

@ -633,6 +633,7 @@ CREATE TABLE events.pages
response_time bigint DEFAULT NULL, response_time bigint DEFAULT NULL,
response_end bigint DEFAULT NULL, response_end bigint DEFAULT NULL,
ttfb integer DEFAULT NULL, ttfb integer DEFAULT NULL,
web_vitals text DEFAULT NULL,
PRIMARY KEY (session_id, message_id) PRIMARY KEY (session_id, message_id)
); );
CREATE INDEX pages_session_id_idx ON events.pages (session_id); CREATE INDEX pages_session_id_idx ON events.pages (session_id);
@ -1327,25 +1328,25 @@ CREATE SCHEMA IF NOT EXISTS spots;
CREATE TABLE IF NOT EXISTS spots.spots CREATE TABLE IF NOT EXISTS spots.spots
( (
spot_id BIGINT NOT NULL PRIMARY KEY, spot_id BIGINT NOT NULL PRIMARY KEY,
name TEXT NOT NULL, name TEXT NOT NULL,
user_id BIGINT NOT NULL REFERENCES public.users (user_id) ON DELETE CASCADE, user_id BIGINT NOT NULL REFERENCES public.users (user_id) ON DELETE CASCADE,
tenant_id BIGINT NOT NULL REFERENCES public.tenants (tenant_id) ON DELETE CASCADE, tenant_id BIGINT NOT NULL REFERENCES public.tenants (tenant_id) ON DELETE CASCADE,
duration INT NOT NULL, duration INT NOT NULL,
crop INT[], crop INT[],
comments TEXT[], comments TEXT[],
status TEXT DEFAULT 'pending', status TEXT DEFAULT 'pending',
created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()), created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()),
updated_at timestamp DEFAULT NULL, updated_at timestamp DEFAULT NULL,
deleted_at timestamp DEFAULT NULL deleted_at timestamp DEFAULT NULL
); );
CREATE TABLE IF NOT EXISTS spots.keys CREATE TABLE IF NOT EXISTS spots.keys
( (
spot_key TEXT NOT NULL PRIMARY KEY, spot_key TEXT NOT NULL PRIMARY KEY,
spot_id BIGINT NOT NULL UNIQUE REFERENCES spots.spots (spot_id) ON DELETE CASCADE, spot_id BIGINT NOT NULL UNIQUE REFERENCES spots.spots (spot_id) ON DELETE CASCADE,
user_id BIGINT NOT NULL, user_id BIGINT NOT NULL,
expiration BIGINT NOT NULL, expiration BIGINT NOT NULL,
expired_at timestamp NOT NULL, expired_at timestamp NOT NULL,
created_at timestamp NOT NULL, created_at timestamp NOT NULL,
updated_at timestamp DEFAULT NULL updated_at timestamp DEFAULT NULL
@ -1353,21 +1354,30 @@ CREATE TABLE IF NOT EXISTS spots.keys
CREATE TABLE IF NOT EXISTS spots.streams CREATE TABLE IF NOT EXISTS spots.streams
( (
spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE,
original_playlist TEXT NOT NULL, original_playlist TEXT NOT NULL,
modified_playlist TEXT NOT NULL, modified_playlist TEXT NOT NULL,
created_at timestamp NOT NULL, created_at timestamp NOT NULL,
expired_at timestamp NOT NULL expired_at timestamp NOT NULL
); );
CREATE TABLE IF NOT EXISTS spots.tasks CREATE TABLE IF NOT EXISTS spots.tasks
( (
spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE,
duration INT NOT NULL, duration INT NOT NULL,
crop INT[], crop INT[],
status TEXT NOT NULL, status TEXT NOT NULL,
error TEXT DEFAULT NULL, error TEXT DEFAULT NULL,
added_time timestamp NOT NULL added_time timestamp NOT NULL
); );
CREATE TABLE IF NOT EXISTS public.session_integrations
(
session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE,
project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE,
provider text NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()),
PRIMARY KEY (session_id, project_id, provider)
);
COMMIT; COMMIT;

View file

@ -17,6 +17,11 @@ $$ LANGUAGE sql IMMUTABLE;
$fn_def$, :'next_version') $fn_def$, :'next_version')
\gexec \gexec
ALTER TABLE IF EXISTS events.pages
DROP COLUMN IF EXISTS web_vitals
DROP TABLE IF EXISTS public.session_integrations;
COMMIT; COMMIT;
\elif :is_next \elif :is_next

View file

@ -19,6 +19,17 @@ $fn_def$, :'next_version')
-- --
ALTER TABLE IF EXISTS events.pages
ADD COLUMN IF NOT EXISTS web_vitals text DEFAULT NULL;
CREATE TABLE IF NOT EXISTS public.session_integrations
(
session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE,
project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE,
provider text NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()),
PRIMARY KEY (session_id, project_id, provider)
);
COMMIT; COMMIT;

View file

@ -594,6 +594,7 @@ CREATE TABLE events.pages
response_time bigint DEFAULT NULL, response_time bigint DEFAULT NULL,
response_end bigint DEFAULT NULL, response_end bigint DEFAULT NULL,
ttfb integer DEFAULT NULL, ttfb integer DEFAULT NULL,
web_vitals text DEFAULT NULL,
PRIMARY KEY (session_id, message_id) PRIMARY KEY (session_id, message_id)
); );
CREATE INDEX pages_session_id_idx ON events.pages (session_id); CREATE INDEX pages_session_id_idx ON events.pages (session_id);
@ -1212,25 +1213,25 @@ CREATE SCHEMA IF NOT EXISTS spots;
CREATE TABLE IF NOT EXISTS spots.spots CREATE TABLE IF NOT EXISTS spots.spots
( (
spot_id BIGINT NOT NULL PRIMARY KEY, spot_id BIGINT NOT NULL PRIMARY KEY,
name TEXT NOT NULL, name TEXT NOT NULL,
user_id BIGINT NOT NULL REFERENCES public.users (user_id) ON DELETE CASCADE, user_id BIGINT NOT NULL REFERENCES public.users (user_id) ON DELETE CASCADE,
tenant_id BIGINT NOT NULL, tenant_id BIGINT NOT NULL,
duration INT NOT NULL, duration INT NOT NULL,
crop INT[], crop INT[],
comments TEXT[], comments TEXT[],
status TEXT DEFAULT 'pending', status TEXT DEFAULT 'pending',
created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()), created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()),
updated_at timestamp DEFAULT NULL, updated_at timestamp DEFAULT NULL,
deleted_at timestamp DEFAULT NULL deleted_at timestamp DEFAULT NULL
); );
CREATE TABLE IF NOT EXISTS spots.keys CREATE TABLE IF NOT EXISTS spots.keys
( (
spot_key TEXT NOT NULL PRIMARY KEY, spot_key TEXT NOT NULL PRIMARY KEY,
spot_id BIGINT NOT NULL UNIQUE REFERENCES spots.spots (spot_id) ON DELETE CASCADE, spot_id BIGINT NOT NULL UNIQUE REFERENCES spots.spots (spot_id) ON DELETE CASCADE,
user_id BIGINT NOT NULL, user_id BIGINT NOT NULL,
expiration BIGINT NOT NULL, expiration BIGINT NOT NULL,
expired_at timestamp NOT NULL, expired_at timestamp NOT NULL,
created_at timestamp NOT NULL, created_at timestamp NOT NULL,
updated_at timestamp DEFAULT NULL updated_at timestamp DEFAULT NULL
@ -1238,21 +1239,30 @@ CREATE TABLE IF NOT EXISTS spots.keys
CREATE TABLE IF NOT EXISTS spots.streams CREATE TABLE IF NOT EXISTS spots.streams
( (
spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE,
original_playlist TEXT NOT NULL, original_playlist TEXT NOT NULL,
modified_playlist TEXT NOT NULL, modified_playlist TEXT NOT NULL,
created_at timestamp NOT NULL, created_at timestamp NOT NULL,
expired_at timestamp NOT NULL expired_at timestamp NOT NULL
); );
CREATE TABLE IF NOT EXISTS spots.tasks CREATE TABLE IF NOT EXISTS spots.tasks
( (
spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE,
duration INT NOT NULL, duration INT NOT NULL,
crop INT[], crop INT[],
status TEXT NOT NULL, status TEXT NOT NULL,
error TEXT DEFAULT NULL, error TEXT DEFAULT NULL,
added_time timestamp NOT NULL added_time timestamp NOT NULL
); );
CREATE TABLE IF NOT EXISTS public.session_integrations
(
session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE,
project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE,
provider text NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()),
PRIMARY KEY (session_id, project_id, provider)
);
COMMIT; COMMIT;

View file

@ -17,6 +17,11 @@ $$ LANGUAGE sql IMMUTABLE;
$fn_def$, :'next_version') $fn_def$, :'next_version')
\gexec \gexec
ALTER TABLE IF EXISTS events.pages
DROP COLUMN IF EXISTS web_vitals;
DROP TABLE IF EXISTS public.session_integrations;
COMMIT; COMMIT;
\elif :is_next \elif :is_next