Api v1.13.0 release (#1343)
* feat(DB): skip delta if wrong_version is detected without stopping global upgrade * fix(chalice): return city&state in the search sessions response
This commit is contained in:
parent
62dc4d7abc
commit
1ce2990a70
30 changed files with 581 additions and 506 deletions
|
|
@ -14,6 +14,8 @@ s.user_browser,
|
|||
s.user_device,
|
||||
s.user_device_type,
|
||||
s.user_country,
|
||||
s.user_city,
|
||||
s.user_state,
|
||||
s.start_ts,
|
||||
s.duration,
|
||||
s.events_count,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ s.user_browser AS user_browser,
|
|||
s.user_device AS user_device,
|
||||
s.user_device_type AS user_device_type,
|
||||
s.user_country AS user_country,
|
||||
s.user_city AS user_city,
|
||||
s.user_state AS user_state,
|
||||
toUnixTimestamp(s.datetime)*1000 AS start_ts,
|
||||
s.duration AS duration,
|
||||
s.events_count AS events_count,
|
||||
|
|
@ -37,6 +39,8 @@ SESSION_PROJECTION_COLS_CH_MAP = """\
|
|||
'user_device', toString(s.user_device),
|
||||
'user_device_type', toString(s.user_device_type),
|
||||
'user_country', toString(s.user_country),
|
||||
'user_city', toString(s.user_city),
|
||||
'user_state', toString(s.user_state),
|
||||
'start_ts', toString(toUnixTimestamp(s.datetime)*1000),
|
||||
'duration', toString(s.duration),
|
||||
'events_count', toString(s.events_count),
|
||||
|
|
|
|||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.9.0-ee';
|
||||
next_version CONSTANT text := 'v1.10.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.9.0-ee'
|
||||
\set next_version 'v1.10.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 'v1.10.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
-- Backup dashboard & search data:
|
||||
DO
|
||||
$$
|
||||
|
|
@ -669,4 +665,10 @@ COMMIT;
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS clicks_selector_idx ON events.clicks (selector);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS clicks_path_idx ON events.clicks (path);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS clicks_path_gin_idx ON events.clicks USING GIN (path gin_trgm_ops);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS issues_project_id_issue_id_idx ON public.issues (project_id, issue_id);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS issues_project_id_issue_id_idx ON public.issues (project_id, issue_id);
|
||||
|
||||
\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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.10.0-ee';
|
||||
next_version CONSTANT text := 'v1.11.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.10.0-ee'
|
||||
\set next_version 'v1.11.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 'v1.11.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
ALTER TYPE issue_type ADD VALUE IF NOT EXISTS 'mouse_thrashing';
|
||||
|
||||
|
|
@ -42,4 +39,10 @@ ALTER TABLE IF EXISTS public.projects
|
|||
"defaultInputMode": "obscured"
|
||||
}'::jsonb;
|
||||
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.11.0-ee';
|
||||
next_version CONSTANT text := 'v1.12.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.11.0-ee'
|
||||
\set next_version 'v1.12.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 'v1.12.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
ALTER TYPE issue_type ADD VALUE IF NOT EXISTS 'app_crash';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.projects_stats
|
||||
|
|
@ -36,4 +32,10 @@ CREATE TABLE IF NOT EXISTS public.projects_stats
|
|||
|
||||
CREATE INDEX IF NOT EXISTS projects_stats_project_id_idx ON public.projects_stats (project_id);
|
||||
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.12.0-ee';
|
||||
next_version CONSTANT text := 'v1.13.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.12.0-ee'
|
||||
\set next_version 'v1.13.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 'v1.13.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.feature_flags
|
||||
(
|
||||
|
|
@ -64,4 +61,10 @@ ALTER TABLE IF EXISTS public.sessions
|
|||
COMMIT;
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS sessions_project_id_user_city_idx ON sessions (project_id, user_city);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS sessions_project_id_user_state_idx ON sessions (project_id, user_state);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS sessions_project_id_user_state_idx ON sessions (project_id, user_state);
|
||||
|
||||
\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
|
||||
|
|
@ -1,26 +1,21 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.4.0-ee';
|
||||
next_version CONSTANT text := 'v1.5.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.4.0-ee'
|
||||
\set next_version 'v1.5.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 'v1.5.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS traces
|
||||
|
|
@ -183,4 +178,10 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS alerts_project_id_idx ON alerts (project
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS alerts_series_id_idx ON alerts (series_id);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS metrics_user_id_is_public_idx ON public.metrics (user_id, is_public);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS metric_series_metric_id_idx ON public.metric_series (metric_id);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS funnels_project_id_idx ON public.funnels (project_id);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS funnels_project_id_idx ON public.funnels (project_id);
|
||||
|
||||
\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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.0-ee';
|
||||
next_version CONSTANT text := 'v1.5.1-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.5.0-ee'
|
||||
\set next_version 'v1.5.1-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 'v1.5.1-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
|
@ -55,3 +52,9 @@ ALTER TYPE country ADD VALUE IF NOT EXISTS 'WK';
|
|||
ALTER TYPE country ADD VALUE IF NOT EXISTS 'YD';
|
||||
ALTER TYPE country ADD VALUE IF NOT EXISTS 'YU';
|
||||
ALTER TYPE country ADD VALUE IF NOT EXISTS 'ZR';
|
||||
|
||||
\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
|
||||
|
|
@ -1,25 +1,28 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.1-ee';
|
||||
next_version CONSTANT text := 'v1.5.2-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.5.1-ee'
|
||||
\set next_version 'v1.5.2-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 'v1.5.2-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
COMMIT;
|
||||
--
|
||||
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.2-ee';
|
||||
next_version CONSTANT text := 'v1.5.3-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.5.2-ee'
|
||||
\set next_version 'v1.5.3-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 'v1.5.3-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
UPDATE metrics
|
||||
SET is_public= TRUE;
|
||||
|
|
@ -112,4 +109,10 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_status_code_nn_idx ON events_co
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_request_body_nn_idx ON events.graphql (request_body) WHERE request_body IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_request_body_nn_gin_idx ON events.graphql USING GIN (request_body gin_trgm_ops) WHERE request_body IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_response_body_nn_idx ON events.graphql (response_body) WHERE response_body IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_response_body_nn_gin_idx ON events.graphql USING GIN (response_body gin_trgm_ops) WHERE response_body IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_response_body_nn_gin_idx ON events.graphql USING GIN (response_body gin_trgm_ops) WHERE response_body IS NOT NULL;
|
||||
|
||||
\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
|
||||
|
|
@ -1,29 +1,25 @@
|
|||
\set ON_ERROR_STOP true
|
||||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.3-ee';
|
||||
next_version CONSTANT text := 'v1.5.4-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
SET client_min_messages TO NOTICE;
|
||||
\set ON_ERROR_STOP true
|
||||
\set previous_version 'v1.5.3-ee'
|
||||
\set next_version 'v1.5.4-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 'v1.5.4-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
-- to detect duplicate users and delete them if possible
|
||||
DO
|
||||
|
|
@ -106,3 +102,9 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_value_usercountryonly_gin_i
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_value_userdeviceonly_gin_idx ON public.autocomplete USING GIN (value gin_trgm_ops) WHERE type = 'USERDEVICE';
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_value_useridonly_gin_idx ON public.autocomplete USING GIN (value gin_trgm_ops) WHERE type = 'USERID';
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_value_userosonly_gin_idx ON public.autocomplete USING GIN (value gin_trgm_ops) WHERE type = 'USEROS';
|
||||
|
||||
\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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.4-ee';
|
||||
next_version CONSTANT text := 'v1.6.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.5.4-ee'
|
||||
\set next_version 'v1.6.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 'v1.6.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS dashboards
|
||||
|
|
@ -362,4 +359,10 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_query_nn_idx ON events.pages (quer
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_query_nn_gin_idx ON events.pages USING GIN (query gin_trgm_ops) WHERE query IS NOT NULL;
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_path_session_id_timestamp_idx ON events.pages (path, session_id, timestamp);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_path_pathLNGT2_idx ON events.pages (path) WHERE length(path) > 2;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_path_pathLNGT2_idx ON events.pages (path) WHERE length(path) > 2;
|
||||
|
||||
\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
|
||||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.6.0-ee';
|
||||
next_version CONSTANT text := 'v1.7.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.6.0-ee'
|
||||
\set next_version 'v1.7.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;
|
||||
CREATE OR REPLACE
|
||||
FUNCTION openreplay_version()
|
||||
SELECT format($fn_def$
|
||||
CREATE OR REPLACE FUNCTION openreplay_version()
|
||||
RETURNS text AS
|
||||
$$
|
||||
SELECT 'v1.7.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
UPDATE roles
|
||||
SET permissions=array_remove(permissions, 'ERRORS');
|
||||
|
|
@ -230,4 +226,10 @@ $$
|
|||
END
|
||||
$$;
|
||||
DROP INDEX IF EXISTS autocomplete_unique;
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.7.0-ee';
|
||||
next_version CONSTANT text := 'v1.8.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.7.0-ee'
|
||||
\set next_version 'v1.8.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 'v1.8.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
ALTER TABLE IF EXISTS projects
|
||||
ADD COLUMN IF NOT EXISTS first_recorded_session_at timestamp without time zone NULL DEFAULT NULL,
|
||||
|
|
@ -65,4 +62,10 @@ DROP INDEX IF EXISTS autocomplete_unique;
|
|||
DROP INDEX IF EXISTS events_common.requests_response_body_nn_idx;
|
||||
DROP INDEX IF EXISTS events_common.requests_request_body_nn_idx;
|
||||
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.8.0-ee';
|
||||
next_version CONSTANT text := 'v1.8.1-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.8.0-ee'
|
||||
\set next_version 'v1.8.1-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 'v1.8.1-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
INSERT INTO metrics (name, category, default_config, is_predefined, is_template, is_public, predefined_key, metric_type,
|
||||
view_type)
|
||||
|
|
@ -52,4 +48,10 @@ DROP INDEX IF EXISTS oauth_authentication_user_id_provider_key;
|
|||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS oauth_authentication_unique_user_id_provider_idx ON oauth_authentication (user_id, provider);
|
||||
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.8.1-ee';
|
||||
next_version CONSTANT text := 'v1.9.0-ee';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.8.1-ee'
|
||||
\set next_version 'v1.9.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 'v1.9.0-ee'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
ALTER TABLE IF EXISTS public.tenants
|
||||
ADD COLUMN IF NOT EXISTS last_telemetry bigint NOT NULL DEFAULT CAST(EXTRACT(epoch FROM date_trunc('day', now())) * 1000 AS BIGINT),
|
||||
|
|
@ -103,4 +100,10 @@ WHERE NOT is_predefined
|
|||
|
||||
COMMIT;
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_session_id_status_code_nn_idx ON events_common.requests (session_id, status_code) WHERE status_code IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_session_id_status_code_nn_idx ON events_common.requests (session_id, status_code) WHERE status_code IS NOT NULL;
|
||||
|
||||
\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
|
||||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.9.0';
|
||||
next_version CONSTANT text := 'v1.10.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.9.0'
|
||||
\set next_version 'v1.10.0'
|
||||
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 'v1.10.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
-- Backup dashboard & search data:
|
||||
DO
|
||||
$$
|
||||
|
|
@ -644,3 +640,9 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS clicks_selector_idx ON events.clicks (se
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS clicks_path_idx ON events.clicks (path);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS clicks_path_gin_idx ON events.clicks USING GIN (path gin_trgm_ops);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS issues_project_id_issue_id_idx ON public.issues (project_id, issue_id);
|
||||
|
||||
\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
|
||||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.10.0';
|
||||
next_version CONSTANT text := 'v1.11.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.10.0'
|
||||
\set next_version 'v1.11.0'
|
||||
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 'v1.11.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
ALTER TYPE issue_type ADD VALUE IF NOT EXISTS 'mouse_thrashing';
|
||||
|
||||
LOCK TABLE ONLY events.inputs IN ACCESS EXCLUSIVE MODE;
|
||||
|
|
@ -42,4 +38,10 @@ ALTER TABLE IF EXISTS public.projects
|
|||
"defaultInputMode": "obscured"
|
||||
}'::jsonb;
|
||||
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.11.0';
|
||||
next_version CONSTANT text := 'v1.12.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.11.0'
|
||||
\set next_version 'v1.12.0'
|
||||
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 'v1.12.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
ALTER TYPE issue_type ADD VALUE IF NOT EXISTS 'app_crash';
|
||||
|
||||
|
|
@ -36,4 +33,10 @@ CREATE TABLE IF NOT EXISTS public.projects_stats
|
|||
|
||||
CREATE INDEX IF NOT EXISTS projects_stats_project_id_idx ON public.projects_stats (project_id);
|
||||
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.12.0';
|
||||
next_version CONSTANT text := 'v1.13.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.12.0'
|
||||
\set next_version 'v1.13.0'
|
||||
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 'v1.13.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.feature_flags
|
||||
(
|
||||
|
|
@ -57,4 +54,10 @@ ALTER TABLE IF EXISTS public.sessions
|
|||
COMMIT;
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS sessions_project_id_user_city_idx ON sessions (project_id, user_city);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS sessions_project_id_user_state_idx ON sessions (project_id, user_state);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS sessions_project_id_user_state_idx ON sessions (project_id, user_state);
|
||||
|
||||
\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
|
||||
|
|
@ -1,26 +1,21 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.4.0';
|
||||
next_version CONSTANT text := 'v1.5.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.4.0'
|
||||
\set next_version 'v1.5.0'
|
||||
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 'v1.5.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
CREATE INDEX IF NOT EXISTS user_favorite_sessions_user_id_session_id_idx ON user_favorite_sessions (user_id, session_id);
|
||||
|
|
@ -111,4 +106,10 @@ ALTER TABLE public.metrics
|
|||
|
||||
CREATE INDEX IF NOT EXISTS resources_timestamp_duration_durationgt0NN_idx ON events.resources (timestamp, duration) WHERE duration > 0 AND duration IS NOT NULL;
|
||||
COMMIT;
|
||||
ALTER TYPE public.error_source ADD VALUE IF NOT EXISTS 'elasticsearch'; -- cannot add new value inside a transaction block
|
||||
ALTER TYPE public.error_source ADD VALUE IF NOT EXISTS 'elasticsearch'; -- cannot add new value inside a transaction block
|
||||
|
||||
\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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.0';
|
||||
next_version CONSTANT text := 'v1.5.1';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.5.0'
|
||||
\set next_version 'v1.5.1'
|
||||
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 'v1.5.1'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
|
@ -54,4 +51,10 @@ ALTER TYPE country ADD VALUE IF NOT EXISTS 'VD';
|
|||
ALTER TYPE country ADD VALUE IF NOT EXISTS 'WK';
|
||||
ALTER TYPE country ADD VALUE IF NOT EXISTS 'YD';
|
||||
ALTER TYPE country ADD VALUE IF NOT EXISTS 'YU';
|
||||
ALTER TYPE country ADD VALUE IF NOT EXISTS 'ZR';
|
||||
ALTER TYPE country ADD VALUE IF NOT EXISTS 'ZR';
|
||||
|
||||
\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
|
||||
|
|
@ -1,25 +1,28 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.1';
|
||||
next_version CONSTANT text := 'v1.5.2';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.5.1'
|
||||
\set next_version 'v1.5.2'
|
||||
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 'v1.5.2'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
COMMIT;
|
||||
--
|
||||
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.2';
|
||||
next_version CONSTANT text := 'v1.5.3';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.5.2'
|
||||
\set next_version 'v1.5.3'
|
||||
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 'v1.5.3'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
UPDATE metrics
|
||||
SET is_public= TRUE;
|
||||
|
|
@ -110,4 +107,10 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_status_code_nn_idx ON events_co
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_request_body_nn_idx ON events.graphql (request_body) WHERE request_body IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_request_body_nn_gin_idx ON events.graphql USING GIN (request_body gin_trgm_ops) WHERE request_body IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_response_body_nn_idx ON events.graphql (response_body) WHERE response_body IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_response_body_nn_gin_idx ON events.graphql USING GIN (response_body gin_trgm_ops) WHERE response_body IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS graphql_response_body_nn_gin_idx ON events.graphql USING GIN (response_body gin_trgm_ops) WHERE response_body IS NOT NULL;
|
||||
|
||||
\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
|
||||
|
|
@ -1,29 +1,25 @@
|
|||
\set ON_ERROR_STOP true
|
||||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.3';
|
||||
next_version CONSTANT text := 'v1.5.4';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
SET client_min_messages TO NOTICE;
|
||||
\set ON_ERROR_STOP true
|
||||
\set previous_version 'v1.5.3'
|
||||
\set next_version 'v1.5.4'
|
||||
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 'v1.5.4'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
-- to detect duplicate users and delete them if possible
|
||||
DO
|
||||
|
|
@ -106,3 +102,9 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_value_usercountryonly_gin_i
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_value_userdeviceonly_gin_idx ON public.autocomplete USING GIN (value gin_trgm_ops) WHERE type = 'USERDEVICE';
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_value_useridonly_gin_idx ON public.autocomplete USING GIN (value gin_trgm_ops) WHERE type = 'USERID';
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS autocomplete_value_userosonly_gin_idx ON public.autocomplete USING GIN (value gin_trgm_ops) WHERE type = 'USEROS';
|
||||
|
||||
\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
|
||||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.5.4';
|
||||
next_version CONSTANT text := 'v1.6.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.5.4'
|
||||
\set next_version 'v1.6.0'
|
||||
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 'v1.6.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS dashboards
|
||||
(
|
||||
|
|
@ -362,4 +358,10 @@ CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_query_nn_idx ON events.pages (quer
|
|||
CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_query_nn_gin_idx ON events.pages USING GIN (query gin_trgm_ops) WHERE query IS NOT NULL;
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_path_session_id_timestamp_idx ON events.pages (path, session_id, timestamp);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_path_pathLNGT2_idx ON events.pages (path) WHERE length(path) > 2;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS pages_path_pathLNGT2_idx ON events.pages (path) WHERE length(path) > 2;
|
||||
|
||||
\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
|
||||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.6.0';
|
||||
next_version CONSTANT text := 'v1.7.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.6.0'
|
||||
\set next_version 'v1.7.0'
|
||||
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 'v1.7.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
ALTER TABLE IF EXISTS dashboards
|
||||
ADD COLUMN IF NOT EXISTS description text NOT NULL DEFAULT '';
|
||||
|
|
@ -218,4 +214,10 @@ $$
|
|||
END
|
||||
$$;
|
||||
DROP INDEX IF EXISTS autocomplete_unique;
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.7.0';
|
||||
next_version CONSTANT text := 'v1.8.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.7.0'
|
||||
\set next_version 'v1.8.0'
|
||||
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 'v1.8.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
ALTER TABLE IF EXISTS projects
|
||||
ADD COLUMN IF NOT EXISTS first_recorded_session_at timestamp without time zone NULL DEFAULT NULL,
|
||||
|
|
@ -64,4 +61,10 @@ BEGIN;
|
|||
DROP INDEX IF EXISTS autocomplete_unique;
|
||||
DROP INDEX IF EXISTS events_common.requests_response_body_nn_idx;
|
||||
DROP INDEX IF EXISTS events_common.requests_request_body_nn_idx;
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,27 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.8.0';
|
||||
next_version CONSTANT text := 'v1.8.1';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.8.0'
|
||||
\set next_version 'v1.8.1'
|
||||
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 'v1.8.1'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
INSERT INTO metrics (name, category, default_config, is_predefined, is_template, is_public, predefined_key, metric_type,
|
||||
view_type)
|
||||
|
|
@ -52,4 +48,10 @@ DROP INDEX IF EXISTS oauth_authentication_user_id_provider_key;
|
|||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS oauth_authentication_unique_user_id_provider_idx ON oauth_authentication (user_id, provider);
|
||||
|
||||
COMMIT;
|
||||
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
|
||||
|
|
@ -1,26 +1,23 @@
|
|||
DO
|
||||
$$
|
||||
DECLARE
|
||||
previous_version CONSTANT text := 'v1.8.1';
|
||||
next_version CONSTANT text := 'v1.9.0';
|
||||
BEGIN
|
||||
IF (SELECT openreplay_version()) = previous_version THEN
|
||||
raise notice 'valid previous DB version';
|
||||
ELSEIF (SELECT openreplay_version()) = next_version THEN
|
||||
raise notice 'new version detected, nothing to do';
|
||||
ELSE
|
||||
RAISE EXCEPTION 'upgrade to % failed, invalid previous version, expected %, got %', next_version,previous_version,(SELECT openreplay_version());
|
||||
END IF;
|
||||
END ;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
\set previous_version 'v1.8.1'
|
||||
\set next_version 'v1.9.0'
|
||||
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 'v1.9.0'
|
||||
SELECT '%1$s'
|
||||
$$ LANGUAGE sql IMMUTABLE;
|
||||
$fn_def$, :'next_version')
|
||||
\gexec
|
||||
|
||||
--
|
||||
|
||||
ALTER TABLE IF EXISTS public.tenants
|
||||
ADD COLUMN IF NOT EXISTS last_telemetry bigint NOT NULL DEFAULT CAST(EXTRACT(epoch FROM date_trunc('day', now())) * 1000 AS BIGINT),
|
||||
|
|
@ -93,4 +90,10 @@ WHERE NOT is_predefined
|
|||
|
||||
COMMIT;
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_session_id_status_code_nn_idx ON events_common.requests (session_id, status_code) WHERE status_code IS NOT NULL;
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS requests_session_id_status_code_nn_idx ON events_common.requests (session_id, status_code) WHERE status_code IS NOT NULL;
|
||||
|
||||
\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
|
||||
Loading…
Add table
Reference in a new issue