diff --git a/api/chalicelib/core/custom_metrics.py b/api/chalicelib/core/custom_metrics.py index 299260ebe..2d2ceee0c 100644 --- a/api/chalicelib/core/custom_metrics.py +++ b/api/chalicelib/core/custom_metrics.py @@ -457,7 +457,7 @@ def get_card(metric_id, project_id, user_id, flatten: bool = True, include_data: with pg_client.PostgresClient() as cur: query = cur.mogrify( f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, deleted_at, edited_at, metric_type, - view_type, metric_of, metric_value, metric_format, is_pinned, predefined_key, default_config, + view_type, metric_of, metric_value, metric_format, is_pinned, default_config, thumbnail, default_config AS config, series, dashboards, owner_email {',data' if include_data else ''} FROM metrics @@ -511,7 +511,7 @@ def get_with_template(metric_id, project_id, user_id, include_dashboard=True): ) AS connected_dashboards ON (TRUE)""" query = cur.mogrify( f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, deleted_at, edited_at, metric_type, - view_type, metric_of, metric_value, metric_format, is_pinned, predefined_key, default_config, + view_type, metric_of, metric_value, metric_format, is_pinned, default_config, thumbnail, default_config AS config, series FROM metrics diff --git a/api/chalicelib/core/sessions.py b/api/chalicelib/core/sessions.py index 651f18e96..0921556af 100644 --- a/api/chalicelib/core/sessions.py +++ b/api/chalicelib/core/sessions.py @@ -858,7 +858,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status, apply = True elif f.type == schemas.FetchFilterType._status_code: event_where.append( - sh.multi_conditions(f"main.status_code {f.operator} %({e_k_f})s::integer", f.value, + sh.multi_conditions(f"main.status_code {f.operator.value} %({e_k_f})s::integer", f.value, value_key=e_k_f)) apply = True elif f.type == schemas.FetchFilterType._method: @@ -867,7 +867,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status, apply = True elif f.type == schemas.FetchFilterType._duration: event_where.append( - sh.multi_conditions(f"main.duration {f.operator} %({e_k_f})s::integer", f.value, + sh.multi_conditions(f"main.duration {f.operator.value} %({e_k_f})s::integer", f.value, value_key=e_k_f)) apply = True elif f.type == schemas.FetchFilterType._request_body: diff --git a/ee/api/chalicelib/core/custom_metrics.py b/ee/api/chalicelib/core/custom_metrics.py index 3ac4012c6..7c3c86bdb 100644 --- a/ee/api/chalicelib/core/custom_metrics.py +++ b/ee/api/chalicelib/core/custom_metrics.py @@ -482,7 +482,7 @@ def get_card(metric_id, project_id, user_id, flatten=True, include_data: bool = with pg_client.PostgresClient() as cur: query = cur.mogrify( f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, deleted_at, edited_at, metric_type, - view_type, metric_of, metric_value, metric_format, is_pinned, predefined_key, default_config, + view_type, metric_of, metric_value, metric_format, is_pinned, default_config, thumbnail, DEFAULT_CONFIG AS config, series, dashboards, owner_email {',data' if include_data else ''} FROM metrics @@ -536,7 +536,7 @@ def get_with_template(metric_id, project_id, user_id, include_dashboard=True): ) AS connected_dashboards ON (TRUE)""" query = cur.mogrify( f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, deleted_at, edited_at, metric_type, - view_type, metric_of, metric_value, metric_format, is_pinned, predefined_key, default_config, + view_type, metric_of, metric_value, metric_format, is_pinned, default_config, thumbnail, default_config AS config, series FROM metrics diff --git a/ee/api/chalicelib/core/sessions.py b/ee/api/chalicelib/core/sessions.py index 8187f9c5f..ed9ca1758 100644 --- a/ee/api/chalicelib/core/sessions.py +++ b/ee/api/chalicelib/core/sessions.py @@ -206,9 +206,9 @@ def search_sessions(data: schemas.SessionsSearchPayloadSchema, project_id, user_ ORDER BY s.session_id desc) AS filtred_sessions ORDER BY {sort} {data.order}, issue_score DESC) AS full_sessions;""", full_args) - print("--------------------") - print(main_query) - print("--------------------") + # print("--------------------") + # print(main_query) + # print("--------------------") try: cur.execute(main_query) except Exception as err: @@ -860,7 +860,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status, apply = True elif f.type == schemas.FetchFilterType._status_code: event_where.append( - sh.multi_conditions(f"main.status_code {f.operator} %({e_k_f})s::integer", f.value, + sh.multi_conditions(f"main.status_code {f.operator.value} %({e_k_f})s::integer", f.value, value_key=e_k_f)) apply = True elif f.type == schemas.FetchFilterType._method: @@ -869,7 +869,7 @@ def search_query_parts(data: schemas.SessionsSearchPayloadSchema, error_status, apply = True elif f.type == schemas.FetchFilterType._duration: event_where.append( - sh.multi_conditions(f"main.duration {f.operator} %({e_k_f})s::integer", f.value, + sh.multi_conditions(f"main.duration {f.operator.value} %({e_k_f})s::integer", f.value, value_key=e_k_f)) apply = True elif f.type == schemas.FetchFilterType._request_body: diff --git a/ee/api/chalicelib/core/sessions_exp.py b/ee/api/chalicelib/core/sessions_exp.py index 1f957380e..b51069d50 100644 --- a/ee/api/chalicelib/core/sessions_exp.py +++ b/ee/api/chalicelib/core/sessions_exp.py @@ -1064,7 +1064,7 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu apply = True elif f.type == schemas.FetchFilterType._status_code: event_where.append( - _multiple_conditions(f"main.status {f.operator} %({e_k_f})s", f.value, + _multiple_conditions(f"main.status {f.operator.value} %({e_k_f})s", f.value, value_key=e_k_f)) events_conditions[-1]["condition"].append(event_where[-1]) apply = True @@ -1075,7 +1075,7 @@ def search_query_parts_ch(data: schemas.SessionsSearchPayloadSchema, error_statu apply = True elif f.type == schemas.FetchFilterType._duration: event_where.append( - _multiple_conditions(f"main.duration {f.operator} %({e_k_f})s", f.value, value_key=e_k_f)) + _multiple_conditions(f"main.duration {f.operator.value} %({e_k_f})s", f.value, value_key=e_k_f)) events_conditions[-1]["condition"].append(event_where[-1]) apply = True elif f.type == schemas.FetchFilterType._request_body: diff --git a/ee/scripts/schema/db/init_dbs/postgresql/1.10.0/1.10.0.sql b/ee/scripts/schema/db/init_dbs/postgresql/1.10.0/1.10.0.sql index ec3eafd05..30961fc88 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/1.10.0/1.10.0.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/1.10.0/1.10.0.sql @@ -91,6 +91,7 @@ $$ ALTER TABLE IF EXISTS metrics DROP COLUMN IF EXISTS active, DROP COLUMN IF EXISTS is_predefined, + DROP COLUMN IF EXISTS predefined_key, DROP COLUMN IF EXISTS is_template, DROP COLUMN IF EXISTS category, DROP COLUMN IF EXISTS o_metric_id, @@ -132,6 +133,7 @@ DROP INDEX IF EXISTS public.sessions_user_browser_gin_idx; DROP INDEX IF EXISTS public.sessions_user_os_gin_idx; DROP INDEX IF EXISTS public.issues_context_string_gin_idx; + ALTER TABLE IF EXISTS projects ADD COLUMN IF NOT EXISTS beacon_size integer NOT NULL DEFAULT 0; @@ -324,7 +326,6 @@ $$ $$ LANGUAGE plpgsql; - DROP FUNCTION get_new_filter_key; DROP FUNCTION get_new_event_filter_key; DROP FUNCTION get_new_event_key; diff --git a/scripts/schema/db/init_dbs/postgresql/1.10.0/1.10.0.sql b/scripts/schema/db/init_dbs/postgresql/1.10.0/1.10.0.sql index f91b976f1..76d6dd88b 100644 --- a/scripts/schema/db/init_dbs/postgresql/1.10.0/1.10.0.sql +++ b/scripts/schema/db/init_dbs/postgresql/1.10.0/1.10.0.sql @@ -300,6 +300,10 @@ $$ $$ LANGUAGE plpgsql; +DROP FUNCTION get_new_filter_key; +DROP FUNCTION get_new_event_filter_key; +DROP FUNCTION get_new_event_key; + DROP TABLE IF EXISTS public.funnels; ALTER TABLE IF EXISTS public.metrics ADD COLUMN IF NOT EXISTS data jsonb NULL;