Files
threshold/internal/db/sqltest/tests/history/targets.sql
T
Andrew GaffneyandHugo 407a0adf4a feat(db): Implement RDP target entities
Also modifies existing database entities to support RDP target.

---------
Co-authored-by: Hugo <10965479+hugoghx@users.noreply.github.com>
2025-09-02 15:13:02 -04:00

29 lines
954 B
PL/PgSQL

-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: BUSL-1.1
begin;
select plan(10);
-- Verify the trigger functions exist and are declared properly
select has_function('insert_target_history_subtype');
select volatility_is('insert_target_history_subtype', 'volatile');
select isnt_strict('insert_target_history_subtype');
select has_function('delete_target_history_subtype');
select volatility_is('delete_target_history_subtype', 'volatile');
select isnt_strict('delete_target_history_subtype');
select has_trigger('target_rdp_hst', 'hst_after_delete');
select has_trigger('target_rdp_hst', 'hst_before_insert');
select fk_ok('target_rdp_hst', 'history_id', 'target_history_base' , 'history_id');
select results_eq(
'select '
'(select count(*) from target_rdp_hst) + '
'(select count(*) from target_ssh_hst)',
'select count(*) from target_history_base'
);
select * from finish();
rollback;