feat(sql): Add endpoint from session table to session recording
This adds an `endpoint` column to the `recording_session` table and updates the session recording insert trigger to copy the value of `endpoint` from the `session` table to the `recording_session` table.
This commit is contained in:
1 parent
06e4e46248
commit
a8224f4f57
3 files changed
+18
-3
No files matched your search
@@ -68,6 +68,7 @@ begin;
|
||||
references host_history_base (history_id)
|
||||
on delete restrict -- History records with session recordings cannot be deleted
|
||||
on update cascade,
|
||||
endpoint text null,
|
||||
create_time wt_timestamp not null,
|
||||
update_time wt_timestamp not null,
|
||||
start_time rec_timestamp null, -- When the session recording was started in the worker
|
||||
@@ -126,6 +127,8 @@ begin;
|
||||
from session
|
||||
where public_id = new.session_id;
|
||||
|
||||
new.endpoint = _session.endpoint;
|
||||
|
||||
select history_id into strict new.user_hst_id
|
||||
from iam_user_hst
|
||||
where public_id = _session.user_id
|
||||
|
||||
@@ -458,8 +458,8 @@ begin;
|
||||
('p____bcolors', 't_________cb', 's1_____carly', 'u______carly', 'tok____carly', 'abc'::bytea, 'ep1'),
|
||||
('p____gcolors', 'tssh______cg', 's1______cora', 'u_______cora', 'tok_____cora', 'abc'::bytea, 'ep1'),
|
||||
--- the next two are used in recording_session tests
|
||||
('p____bcolors', 'tssh______cb', 's2_____clare', 'u______clare', 'tok____clare', 'abc'::bytea, 'ep1'),
|
||||
('p____gcolors', 'tssh______cg', 's2______cora', 'u_______cora', 'tok_____cora', 'abc'::bytea, 'ep1');
|
||||
('p____bcolors', 'tssh______cb', 's2_____clare', 'u______clare', 'tok____clare', 'abc'::bytea, 'ep2'),
|
||||
('p____gcolors', 'tssh______cg', 's2______cora', 'u_______cora', 'tok_____cora', 'abc'::bytea, 'ep3');
|
||||
|
||||
insert into session_credential_static
|
||||
(session_id, credential_static_id, credential_purpose)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
-- end_time_null_or_after_start_time
|
||||
|
||||
begin;
|
||||
select plan(53);
|
||||
select plan(56);
|
||||
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets', 'sessions');
|
||||
|
||||
select has_view('session_recording_aggregate', 'view for aggregating session recording info does not exist');
|
||||
@@ -57,6 +57,10 @@ begin;
|
||||
'select host_hst_id from recording_session where public_id = ''sr1_____cora''',
|
||||
'select history_id from no_host_history');
|
||||
|
||||
select results_eq(
|
||||
'select endpoint from recording_session where public_id = ''sr1_____cora''',
|
||||
'select endpoint from session where public_id = ''s1______cora''');
|
||||
|
||||
-- Try to insert row with null session id
|
||||
prepare insert_invalid_recording_session as
|
||||
insert into recording_session
|
||||
@@ -80,6 +84,10 @@ begin;
|
||||
('sr_________1', 'sb____global', 's2_____clare', 'started');
|
||||
select lives_ok('insert_recording_session');
|
||||
|
||||
select results_eq(
|
||||
'select endpoint from recording_session where public_id = ''sr_________1''',
|
||||
'select endpoint from session where public_id = ''s2_____clare''');
|
||||
|
||||
prepare insert_recording_session_target_address as
|
||||
insert into recording_session
|
||||
(public_id, storage_bucket_id, session_id)
|
||||
@@ -87,6 +95,10 @@ begin;
|
||||
('sr_________2', 'sb____global', 's2______cora');
|
||||
select lives_ok('insert_recording_session_target_address');
|
||||
|
||||
select results_eq(
|
||||
'select endpoint from recording_session where public_id = ''sr_________2''',
|
||||
'select endpoint from session where public_id = ''s2______cora''');
|
||||
|
||||
-- Try to set end_time before start_time
|
||||
prepare invalid_close_recording_session as
|
||||
update recording_session set
|
||||
|
||||
Reference in new issue
Block a user