From 31918438293f5b603f983dd7af9362e4b5ddf0cc Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 10 Feb 2025 12:21:20 +0100 Subject: [PATCH] change(ui): highlights messages to be nullable --- api/schemas/schemas.py | 2 +- ee/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql | 7 +++++++ ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql | 2 +- scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql | 3 ++- scripts/schema/db/init_dbs/postgresql/init_schema.sql | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/api/schemas/schemas.py b/api/schemas/schemas.py index 07ceb8e18..e61756886 100644 --- a/api/schemas/schemas.py +++ b/api/schemas/schemas.py @@ -1396,7 +1396,7 @@ class SearchNoteSchema(_PaginatedSchema): class SessionNoteSchema(BaseModel): - message: str = Field(..., min_length=2) + message: Optional[str] = Field(..., min_length=2) tag: Optional[str] = Field(default=None) timestamp: int = Field(default=-1) is_public: bool = Field(default=False) diff --git a/ee/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql b/ee/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql index f0e1277e9..b0d482240 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql @@ -26,6 +26,13 @@ WHERE metrics.metric_type = 'insights'; DROP TABLE IF EXISTS public.user_favorite_errors; DROP TABLE IF EXISTS public.user_viewed_errors; +ALTER TABLE IF EXISTS public.sessions_notes + ADD COLUMN start_at integer, + ADD COLUMN end_at integer, + ADD COLUMN thumbnail text, + ADD COLUMN updated_at timestamp DEFAULT NULL, + ALTER COLUMN message DROP NOT NULL; + 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 4c519fda1..5e54e440c 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -929,7 +929,7 @@ EXECUTE PROCEDURE notify_alert(); CREATE TABLE public.sessions_notes ( note_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY, - message text NOT NULL, + message text NULL DEFAULT NULL, created_at timestamp without time zone NOT NULL DEFAULT (now() at time zone 'utc'), user_id integer NULL REFERENCES public.users (user_id) ON DELETE SET NULL, deleted_at timestamp without time zone NULL DEFAULT NULL, diff --git a/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql b/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql index dcf474499..0169357fc 100644 --- a/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql +++ b/scripts/schema/db/init_dbs/postgresql/1.22.0/1.22.0.sql @@ -30,7 +30,8 @@ ALTER TABLE IF EXISTS public.sessions_notes ADD COLUMN start_at integer, ADD COLUMN end_at integer, ADD COLUMN thumbnail text, - ADD COLUMN updated_at timestamp DEFAULT NULL; + ADD COLUMN updated_at timestamp DEFAULT NULL, + ALTER COLUMN message DROP NOT NULL; COMMIT; diff --git a/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/scripts/schema/db/init_dbs/postgresql/init_schema.sql index dbcbdf594..b10d2cc3d 100644 --- a/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -889,7 +889,7 @@ EXECUTE PROCEDURE notify_alert(); CREATE TABLE public.sessions_notes ( note_id integer generated BY DEFAULT AS IDENTITY PRIMARY KEY, - message text NOT NULL, + message text NULL DEFAULT NULL, created_at timestamp without time zone NOT NULL DEFAULT (now() at time zone 'utc'), user_id integer NULL REFERENCES public.users (user_id) ON DELETE SET NULL, deleted_at timestamp without time zone NULL DEFAULT NULL,