From 966f08e95d862fb92c178513658cddc174c2faca Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Tue, 3 Sep 2024 15:18:27 +0200 Subject: [PATCH] Dev (#2531) * 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): rollback script feat(DB): changed users.settings default value --- .../schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql | 8 ++++++++ ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql | 7 ++++++- .../schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql | 3 +++ scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql | 8 ++++++++ scripts/schema/db/init_dbs/postgresql/init_schema.sql | 7 ++++++- .../schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql | 3 +++ 6 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ee/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql b/ee/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql index 3e5309c4c..a0da9c99a 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql @@ -53,6 +53,14 @@ CREATE TABLE IF NOT EXISTS or_cache.autocomplete_top_values ALTER TABLE IF EXISTS public.tenants ADD COLUMN IF NOT EXISTS scope_state smallint NOT NULL DEFAULT 2; +ALTER TABLE IF EXISTS public.users + ALTER COLUMN settings SET DEFAULT '{ + "modules": [ + "usability-tests", + "feature-flags" + ] + }'::jsonb; + COMMIT; \elif :is_next diff --git a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql index 987bc18e7..c7cd5791f 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -143,7 +143,12 @@ CREATE TABLE public.users spot_jwt_refresh_iat timestamp without time zone NULL DEFAULT NULL, data jsonb NOT NULL DEFAULT '{}'::jsonb, weekly_report boolean NOT NULL DEFAULT TRUE, - settings jsonb DEFAULT NULL, + settings jsonb DEFAULT '{ + "modules": [ + "usability-tests", + "feature-flags" + ] + }'::jsonb, origin text NULL DEFAULT NULL, role_id integer REFERENCES public.roles (role_id) ON DELETE SET NULL, internal_id text NULL DEFAULT NULL, diff --git a/ee/scripts/schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql b/ee/scripts/schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql index b04a254fa..141ddbc68 100644 --- a/ee/scripts/schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql +++ b/ee/scripts/schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql @@ -25,6 +25,9 @@ ALTER TABLE IF EXISTS public.users DROP SCHEMA or_cache CASCADE; +ALTER TABLE IF EXISTS public.tenants + DROP COLUMN IF EXISTS scope_state; + COMMIT; \elif :is_next diff --git a/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql b/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql index 3e5646302..53b524cb7 100644 --- a/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql +++ b/scripts/schema/db/init_dbs/postgresql/1.20.0/1.20.0.sql @@ -42,6 +42,14 @@ CREATE TABLE IF NOT EXISTS or_cache.autocomplete_top_values ALTER TABLE IF EXISTS public.tenants ADD COLUMN IF NOT EXISTS scope_state smallint NOT NULL DEFAULT 2; +ALTER TABLE IF EXISTS public.users + ALTER COLUMN settings SET DEFAULT '{ + "modules": [ + "usability-tests", + "feature-flags" + ] + }'::jsonb; + COMMIT; \elif :is_next diff --git a/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/scripts/schema/db/init_dbs/postgresql/init_schema.sql index 24229317f..d1db449fe 100644 --- a/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -127,7 +127,12 @@ CREATE TABLE public.users spot_jwt_refresh_iat timestamp without time zone NULL DEFAULT NULL, data jsonb NOT NULL DEFAULT '{}'::jsonb, weekly_report boolean NOT NULL DEFAULT TRUE, - settings jsonb DEFAULT NULL + settings jsonb DEFAULT '{ + "modules": [ + "usability-tests", + "feature-flags" + ] + }'::jsonb ); CREATE TABLE public.basic_authentication diff --git a/scripts/schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql b/scripts/schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql index 685d4a9fd..d61297cc1 100644 --- a/scripts/schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql +++ b/scripts/schema/db/rollback_dbs/postgresql/1.20.0/1.20.0.sql @@ -25,6 +25,9 @@ ALTER TABLE IF EXISTS public.users DROP SCHEMA or_cache CASCADE; +ALTER TABLE IF EXISTS public.tenants + DROP COLUMN IF EXISTS scope_state; + COMMIT; \elif :is_next