openreplay/ee/scripts/schema/db/init_dbs/postgresql/1.16.0/1.16.0.sql
Rajesh Rajendran 4c7f2edd57
Api v1.16.0 (#1730)
* feat(api): usability testing (#1686)

* feat(api): usability testing - wip

* feat(db): usabiity testing

* feat(api): usability testing - api

* feat(api): usability testing - api

* feat(api): usability testing - db change

* feat(api): usability testing - db change

* feat(api): usability testing - unit tests update

* feat(api): usability testing - test and tasks stats

* feat(api): usability testing - sessions list fix, return zeros if test id is not having signals

* Api v1.16.0 (#1698)

* feat: canvas support [assist] (#1641)

* feat(tracker/ui): start canvas support

* feat(tracker): slpeer -> peerjs for canvas streams

* fix(ui): fix agent canvas peer id

* fix(ui): fix agent canvas peer id

* fix(ui): fix peer removal

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(ui): canvas support for ui

* fix(tracker): fix falling tests

* feat(ui): replay canvas in video

* feat(ui): refactor video streaming to draw on canvas

* feat(ui): 10hz check for canvas replay

* feat(ui): fix for tests

* feat(ui): fix for tests

* feat(ui): fix for tests

* feat(ui): fix for tests cov

* feat(ui): mroe test coverage

* fix(ui): styling

* fix(tracker): support backend settings for canvas

* feat(ui): allow devtools to be resizeable (#1605)

* fix(ui): console redux tab null check

* Api v1.15.0 (#1689)

* fix(chalice): fix create alert with MS Teams notification channel
closes openreplay/openreplay#1677

* fix(chalice): fix MS Teams notifications
* refactor(chalice): enhanced MS Teams notifications
closes openreplay/openreplay#1681

(cherry picked from commit 265897f509)

* fix(ui): filter keys conflcit with metadata, path analysis 4 col

* fix(ui): clear the filers and series on card type change

* fix(player): fix msg reader bug

* fix(DB): fix CH wrong version (#1692)

(cherry picked from commit 48dbbb55db)

* fix(ui): filter keys conflcit with metadata

* fix(tracker): unique broadcast channel name

* fix(chalice): fixed delete cards (#1697)

(cherry picked from commit 92fedd310c)

* fix(tracker): add trycatch to ignore iframe errors

* feat(backend): added ARM arch support to backend services [Dockerfile]

* feat(backend): removed userAgent from sessions and unstarted-sessions tables

* fix(DB): change path-analysis card size

---------

Co-authored-by: Delirium <nikita@openreplay.com>
Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
Co-authored-by: Alexander <zavorotynskiy@pm.me>

* refactor(chalice): cleaned code (#1699)

* feat(api): usability testing - added start_path to the resposne, remove count from the list

* feat(api): usability testing - test to have response count and live count

* feat(api): usability testing - test to have additional data

* Revert "refactor(chalice): cleaned code (#1699)" (#1702)

This reverts commit 83f2b0c12c.

* feat(api): usability testing - responses with total and other improvements

* change(api): vulnerability whitelist udpate

* feat(api): usability testing - create added missing columns, and sessions with user_id search

* feat(api): usability testing - update test with responseCount

* feat(api): usability testing - timestamps in unix

* feat(api): usability testing - request with proper case change

* feat(api): usability testing - task.description nullable

* feat(api): usability testing - check deleted status

* Api v1.16.0 (#1707)

* fix(chalice): fixed search sessions

* fix(chalice): fixed search sessions
* refactor(chalice): upgraded dependencies
* refactor(crons): upgraded dependencies
* refactor(alerts): upgraded dependencies

* Api v1.16.0 (#1712)

* feat(DB): user-testing support

* feat(chalice): user testing support

* feat(chalice): support utxVideo (#1726)

* feat(chalice): changed bucket name for ux testing webcamera videos

---------

Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
Co-authored-by: Kraiem Taha Yassine <tahayk2@gmail.com>
Co-authored-by: Delirium <nikita@openreplay.com>
Co-authored-by: Alexander <zavorotynskiy@pm.me>
2023-11-30 10:53:31 +01:00

120 lines
No EOL
4.6 KiB
PL/PgSQL

\set previous_version 'v1.15.0-ee'
\set next_version 'v1.16.0-ee'
SELECT openreplay_version() AS current_version,
openreplay_version() = :'previous_version' AS valid_previous,
openreplay_version() = :'next_version' AS is_next
\gset
\if :valid_previous
\echo valid previous DB version :'previous_version', starting DB upgrade to :'next_version'
BEGIN;
SELECT format($fn_def$
CREATE OR REPLACE FUNCTION openreplay_version()
RETURNS text AS
$$
SELECT '%1$s'
$$ LANGUAGE sql IMMUTABLE;
$fn_def$, :'next_version')
\gexec
--
DO
$$
BEGIN
IF NOT EXISTS(SELECT *
FROM pg_type typ
INNER JOIN pg_namespace nsp
ON nsp.oid = typ.typnamespace
WHERE nsp.nspname = current_schema()
AND typ.typname = 'ui_tests_status') THEN
CREATE TYPE ui_tests_status AS ENUM ('preview', 'in-progress', 'paused', 'closed');
END IF;
END;
$$
LANGUAGE plpgsql;
CREATE TABLE IF NOT EXISTS public.ut_tests
(
test_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY,
project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE,
title VARCHAR(255) NOT NULL,
starting_path VARCHAR(255) NULL,
status ui_tests_status NOT NULL,
require_mic BOOLEAN DEFAULT FALSE,
require_camera BOOLEAN DEFAULT FALSE,
description TEXT NULL,
guidelines TEXT NULL,
conclusion_message TEXT NULL,
created_by integer REFERENCES public.users (user_id) ON DELETE SET NULL,
updated_by integer REFERENCES public.users (user_id) ON DELETE SET NULL,
visibility BOOLEAN DEFAULT FALSE,
created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()),
updated_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()),
deleted_at timestamp without time zone NULL DEFAULT NULL
);
CREATE TABLE IF NOT EXISTS public.ut_tests_tasks
(
task_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY,
test_id integer NOT NULL REFERENCES ut_tests (test_id) ON DELETE CASCADE,
title VARCHAR(255) NOT NULL,
description TEXT NULL,
allow_typing BOOLEAN DEFAULT FALSE
);
DO
$$
BEGIN
IF NOT EXISTS(SELECT *
FROM pg_type typ
INNER JOIN pg_namespace nsp
ON nsp.oid = typ.typnamespace
WHERE nsp.nspname = current_schema()
AND typ.typname = 'ut_signal_status') THEN
CREATE TYPE ut_signal_status AS ENUM ('begin', 'done', 'skipped');
END IF;
END;
$$
LANGUAGE plpgsql;
CREATE TABLE IF NOT EXISTS public.ut_tests_signals
(
signal_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY,
session_id BIGINT NULL REFERENCES public.sessions (session_id) ON DELETE SET NULL,
test_id integer NOT NULL REFERENCES public.ut_tests (test_id) ON DELETE CASCADE,
task_id integer NULL REFERENCES public.ut_tests_tasks (task_id) ON DELETE CASCADE,
status ut_signal_status NOT NULL,
comment TEXT NULL,
timestamp BIGINT NOT NULL,
duration BIGINT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS ut_tests_signals_unique_session_id_test_id_task_id_ts_idx ON public.ut_tests_signals (session_id, test_id, task_id, timestamp);
CREATE INDEX IF NOT EXISTS ut_tests_signals_session_id_idx ON public.ut_tests_signals (session_id);
CREATE TABLE IF NOT EXISTS events.canvas_recordings
(
session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE,
recording_id text NOT NULL,
timestamp bigint NOT NULL
);
CREATE INDEX IF NOT EXISTS canvas_recordings_session_id_idx ON events.canvas_recordings (session_id);
DROP SCHEMA IF EXISTS backup_v1_10_0 CASCADE;
UPDATE metrics
SET default_config='{
"col": 4,
"row": 2,
"position": 0
}'::jsonb
WHERE metric_type = 'pathAnalysis';
COMMIT;
\elif :is_next
\echo new version detected :'next_version', nothing to do
\else
\warn skipping DB upgrade of :'next_version', expected previous version :'previous_version', found :'current_version'
\endif