feat(db): conditional capture db changes for ee

This commit is contained in:
Shekar Siri 2024-01-12 11:46:11 +01:00
parent e35a4cea7c
commit 650df7090d
3 changed files with 34 additions and 2 deletions

View file

@ -29,6 +29,18 @@ UPDATE public.sessions
SET has_ut_test= TRUE
WHERE session_id IN (SELECT session_id FROM public.ut_tests_signals);
ALTER TABLE IF EXISTS public.projects
ADD COLUMN IF NOT EXISTS conditional_capture boolean DEFAULT FALSE;
CREATE TABLE IF NOT EXISTS public.projects_conditions
(
condition_id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE,
name varchar(255) NOT NULL,
capture_rate integer NOT NULL CHECK (capture_rate >= 0 AND capture_rate <= 100),
filters jsonb NOT NULL DEFAULT '[]'::jsonb
);
COMMIT;
\elif :is_next

View file

@ -222,7 +222,8 @@ $$
}'::jsonb,
first_recorded_session_at timestamp without time zone NULL DEFAULT NULL,
sessions_last_check_at timestamp without time zone NULL DEFAULT NULL,
beacon_size integer NOT NULL DEFAULT 0
beacon_size integer NOT NULL DEFAULT 0,
conditional_capture boolean NOT NULL DEFAULT FALSE
);
CREATE INDEX projects_project_key_idx ON public.projects (project_key);
@ -1293,6 +1294,15 @@ $$
time BIGINT not null
);
CREATE TABLE IF NOT EXISTS public.projects_conditions
(
condition_id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE,
name varchar(255) NOT NULL,
capture_rate integer NOT NULL CHECK (capture_rate >= 0 AND capture_rate <= 100),
filters jsonb NOT NULL DEFAULT '[]'::jsonb
);
raise notice 'DB created';
END IF;
END;

View file

@ -199,7 +199,8 @@ $$
}'::jsonb,
first_recorded_session_at timestamp without time zone NULL DEFAULT NULL,
sessions_last_check_at timestamp without time zone NULL DEFAULT NULL,
beacon_size integer NOT NULL DEFAULT 0
beacon_size integer NOT NULL DEFAULT 0,
conditional_capture boolean NOT NULL DEFAULT FALSE
);
CREATE INDEX projects_project_key_idx ON public.projects (project_key);
@ -1178,6 +1179,15 @@ $$
);
CREATE INDEX canvas_recordings_session_id_idx ON events.canvas_recordings (session_id);
CREATE TABLE IF NOT EXISTS public.projects_conditions
(
condition_id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE,
name varchar(255) NOT NULL,
capture_rate integer NOT NULL CHECK (capture_rate >= 0 AND capture_rate <= 100),
filters jsonb NOT NULL DEFAULT '[]'::jsonb
);
raise notice 'DB created';
END IF;
END;