diff --git a/ee/scripts/schema/db/init_dbs/postgresql/1.21.0/1.21.0.sql b/ee/scripts/schema/db/init_dbs/postgresql/1.21.0/1.21.0.sql index 85f1bf505..1ece9429f 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/1.21.0/1.21.0.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/1.21.0/1.21.0.sql @@ -23,6 +23,18 @@ UPDATE public.roles SET permissions='{SERVICE_SESSION_REPLAY,SERVICE_DEV_TOOLS,SERVICE_ASSIST_LIVE,SERVICE_ASSIST_CALL,SERVICE_READ_NOTES}' WHERE service_role; +ALTER TABLE IF EXISTS events.pages + ADD COLUMN IF NOT EXISTS web_vitals text DEFAULT NULL; + +CREATE TABLE IF NOT EXISTS public.session_integrations +( + session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE, + project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE, + provider text NOT NULL, + created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()), + PRIMARY KEY (session_id, project_id, provider) +); + 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 c74987108..9cf444947 100644 --- a/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/ee/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -633,6 +633,7 @@ CREATE TABLE events.pages response_time bigint DEFAULT NULL, response_end bigint DEFAULT NULL, ttfb integer DEFAULT NULL, + web_vitals text DEFAULT NULL, PRIMARY KEY (session_id, message_id) ); CREATE INDEX pages_session_id_idx ON events.pages (session_id); @@ -1327,25 +1328,25 @@ CREATE SCHEMA IF NOT EXISTS spots; CREATE TABLE IF NOT EXISTS spots.spots ( - spot_id BIGINT NOT NULL PRIMARY KEY, - name TEXT NOT NULL, - user_id BIGINT NOT NULL REFERENCES public.users (user_id) ON DELETE CASCADE, - tenant_id BIGINT NOT NULL REFERENCES public.tenants (tenant_id) ON DELETE CASCADE, - duration INT NOT NULL, + spot_id BIGINT NOT NULL PRIMARY KEY, + name TEXT NOT NULL, + user_id BIGINT NOT NULL REFERENCES public.users (user_id) ON DELETE CASCADE, + tenant_id BIGINT NOT NULL REFERENCES public.tenants (tenant_id) ON DELETE CASCADE, + duration INT NOT NULL, crop INT[], comments TEXT[], - status TEXT DEFAULT 'pending', + status TEXT DEFAULT 'pending', created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()), - updated_at timestamp DEFAULT NULL, - deleted_at timestamp DEFAULT NULL + updated_at timestamp DEFAULT NULL, + deleted_at timestamp DEFAULT NULL ); CREATE TABLE IF NOT EXISTS spots.keys ( - spot_key TEXT NOT NULL PRIMARY KEY, - spot_id BIGINT NOT NULL UNIQUE REFERENCES spots.spots (spot_id) ON DELETE CASCADE, - user_id BIGINT NOT NULL, - expiration BIGINT NOT NULL, + spot_key TEXT NOT NULL PRIMARY KEY, + spot_id BIGINT NOT NULL UNIQUE REFERENCES spots.spots (spot_id) ON DELETE CASCADE, + user_id BIGINT NOT NULL, + expiration BIGINT NOT NULL, expired_at timestamp NOT NULL, created_at timestamp NOT NULL, updated_at timestamp DEFAULT NULL @@ -1353,21 +1354,30 @@ CREATE TABLE IF NOT EXISTS spots.keys CREATE TABLE IF NOT EXISTS spots.streams ( - spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, - original_playlist TEXT NOT NULL, - modified_playlist TEXT NOT NULL, + spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, + original_playlist TEXT NOT NULL, + modified_playlist TEXT NOT NULL, created_at timestamp NOT NULL, expired_at timestamp NOT NULL ); CREATE TABLE IF NOT EXISTS spots.tasks ( - spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, - duration INT NOT NULL, + spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, + duration INT NOT NULL, crop INT[], - status TEXT NOT NULL, + status TEXT NOT NULL, error TEXT DEFAULT NULL, added_time timestamp NOT NULL ); +CREATE TABLE IF NOT EXISTS public.session_integrations +( + session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE, + project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE, + provider text NOT NULL, + created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()), + PRIMARY KEY (session_id, project_id, provider) +); + COMMIT; \ No newline at end of file diff --git a/ee/scripts/schema/db/rollback_dbs/postgresql/1.21.0/1.21.0.sql b/ee/scripts/schema/db/rollback_dbs/postgresql/1.21.0/1.21.0.sql index af13e63e6..7fc1e20d2 100644 --- a/ee/scripts/schema/db/rollback_dbs/postgresql/1.21.0/1.21.0.sql +++ b/ee/scripts/schema/db/rollback_dbs/postgresql/1.21.0/1.21.0.sql @@ -17,6 +17,11 @@ $$ LANGUAGE sql IMMUTABLE; $fn_def$, :'next_version') \gexec +ALTER TABLE IF EXISTS events.pages + DROP COLUMN IF EXISTS web_vitals + +DROP TABLE IF EXISTS public.session_integrations; + COMMIT; \elif :is_next diff --git a/scripts/schema/db/init_dbs/postgresql/1.21.0/1.21.0.sql b/scripts/schema/db/init_dbs/postgresql/1.21.0/1.21.0.sql index 118241ab5..4ab6e29d6 100644 --- a/scripts/schema/db/init_dbs/postgresql/1.21.0/1.21.0.sql +++ b/scripts/schema/db/init_dbs/postgresql/1.21.0/1.21.0.sql @@ -19,6 +19,17 @@ $fn_def$, :'next_version') -- +ALTER TABLE IF EXISTS events.pages + ADD COLUMN IF NOT EXISTS web_vitals text DEFAULT NULL; + +CREATE TABLE IF NOT EXISTS public.session_integrations +( + session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE, + project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE, + provider text NOT NULL, + created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()), + PRIMARY KEY (session_id, project_id, provider) +); COMMIT; diff --git a/scripts/schema/db/init_dbs/postgresql/init_schema.sql b/scripts/schema/db/init_dbs/postgresql/init_schema.sql index 143f64b73..52f003886 100644 --- a/scripts/schema/db/init_dbs/postgresql/init_schema.sql +++ b/scripts/schema/db/init_dbs/postgresql/init_schema.sql @@ -594,6 +594,7 @@ CREATE TABLE events.pages response_time bigint DEFAULT NULL, response_end bigint DEFAULT NULL, ttfb integer DEFAULT NULL, + web_vitals text DEFAULT NULL, PRIMARY KEY (session_id, message_id) ); CREATE INDEX pages_session_id_idx ON events.pages (session_id); @@ -1212,25 +1213,25 @@ CREATE SCHEMA IF NOT EXISTS spots; CREATE TABLE IF NOT EXISTS spots.spots ( - spot_id BIGINT NOT NULL PRIMARY KEY, - name TEXT NOT NULL, - user_id BIGINT NOT NULL REFERENCES public.users (user_id) ON DELETE CASCADE, - tenant_id BIGINT NOT NULL, - duration INT NOT NULL, + spot_id BIGINT NOT NULL PRIMARY KEY, + name TEXT NOT NULL, + user_id BIGINT NOT NULL REFERENCES public.users (user_id) ON DELETE CASCADE, + tenant_id BIGINT NOT NULL, + duration INT NOT NULL, crop INT[], comments TEXT[], - status TEXT DEFAULT 'pending', + status TEXT DEFAULT 'pending', created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()), - updated_at timestamp DEFAULT NULL, - deleted_at timestamp DEFAULT NULL + updated_at timestamp DEFAULT NULL, + deleted_at timestamp DEFAULT NULL ); CREATE TABLE IF NOT EXISTS spots.keys ( - spot_key TEXT NOT NULL PRIMARY KEY, - spot_id BIGINT NOT NULL UNIQUE REFERENCES spots.spots (spot_id) ON DELETE CASCADE, - user_id BIGINT NOT NULL, - expiration BIGINT NOT NULL, + spot_key TEXT NOT NULL PRIMARY KEY, + spot_id BIGINT NOT NULL UNIQUE REFERENCES spots.spots (spot_id) ON DELETE CASCADE, + user_id BIGINT NOT NULL, + expiration BIGINT NOT NULL, expired_at timestamp NOT NULL, created_at timestamp NOT NULL, updated_at timestamp DEFAULT NULL @@ -1238,21 +1239,30 @@ CREATE TABLE IF NOT EXISTS spots.keys CREATE TABLE IF NOT EXISTS spots.streams ( - spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, - original_playlist TEXT NOT NULL, - modified_playlist TEXT NOT NULL, + spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, + original_playlist TEXT NOT NULL, + modified_playlist TEXT NOT NULL, created_at timestamp NOT NULL, expired_at timestamp NOT NULL ); CREATE TABLE IF NOT EXISTS spots.tasks ( - spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, - duration INT NOT NULL, + spot_id BIGINT NOT NULL PRIMARY KEY REFERENCES spots.spots (spot_id) ON DELETE CASCADE, + duration INT NOT NULL, crop INT[], - status TEXT NOT NULL, + status TEXT NOT NULL, error TEXT DEFAULT NULL, added_time timestamp NOT NULL ); +CREATE TABLE IF NOT EXISTS public.session_integrations +( + session_id bigint NOT NULL REFERENCES public.sessions (session_id) ON DELETE CASCADE, + project_id integer NOT NULL REFERENCES public.projects (project_id) ON DELETE CASCADE, + provider text NOT NULL, + created_at timestamp without time zone NOT NULL DEFAULT timezone('utc'::text, now()), + PRIMARY KEY (session_id, project_id, provider) +); + COMMIT; \ No newline at end of file diff --git a/scripts/schema/db/rollback_dbs/postgresql/1.21.0/1.21.0.sql b/scripts/schema/db/rollback_dbs/postgresql/1.21.0/1.21.0.sql index dcd2db62e..c75bc34c5 100644 --- a/scripts/schema/db/rollback_dbs/postgresql/1.21.0/1.21.0.sql +++ b/scripts/schema/db/rollback_dbs/postgresql/1.21.0/1.21.0.sql @@ -17,6 +17,11 @@ $$ LANGUAGE sql IMMUTABLE; $fn_def$, :'next_version') \gexec +ALTER TABLE IF EXISTS events.pages + DROP COLUMN IF EXISTS web_vitals; + +DROP TABLE IF EXISTS public.session_integrations; + COMMIT; \elif :is_next