-- # 생성한 Report 가 저장되는 테이블
-- report_applicationentity(savedReport_id)
-- savedreport(reportOutputDoc_id) 인덱스를
-- documentinfo(id) 테이블에서 삭제한다.
-- documentinfo(fileBlob_id) 컬럼의 인덱스를 datablob(id)에서 삭제한다.
-- # CSV로 Audit에서 Export한 리포트가 저장되는 테이블
-- dataexport 의 documentInfo_id 컬럼값을
-- documentinfo(id) 테이블에서 삭제한다.
-- documentinfo(fileBlob_id) 컬럼의 인덱스를 datablob(id)에서 삭제한다.
-- ########################################################
-- #
-- # Fortify SSC에서 생성한 일반 리포트를 모두 삭제한다.
-- #
-- ########################################################
-- 1.datablob 삭제
DELETE FROM
datablob
WHERE
id IN (
SELECT
T3.fileBlob_id
FROM
report_applicationentity AS T1
LEFT JOIN savedreport AS T2 ON T1.savedReport_id = T2.id
LEFT JOIN documentinfo AS T3 ON T2.reportOutputDoc_id = T3.id
);
-- 2. documentinfo 삭제
DELETE FROM
documentinfo
WHERE
id IN (
SELECT
T2.reportOutputDoc_id
FROM
report_applicationentity AS T1
LEFT JOIN savedreport AS T2 ON T1.savedReport_id = T2.id
);
-- 3. savedreport, report_applicationentity 삭제
DELETE FROM
savedreport
WHERE
id IN (
SELECT
savedReport_id
FROM
report_applicationentity
);
-- ########################################################
-- #
-- # Fortify SSC Audit에서 Export 처리했던 리포트를 모두
-- # 삭제한다.
-- #
-- ########################################################
-- 1.datablob 삭제
DELETE FROM
datablob
WHERE
id IN (
SELECT
T2.fileBlob_id
FROM
dataexport AS T1
LEFT JOIN documentinfo AS T2 ON T1.documentInfo_id = T2.id
);
-- 2. documentinfo 삭제
DELETE FROM
documentinfo
WHERE
id IN (
SELECT
documentInfo_id
FROM
dataexport
);
-- 3. dataexport 삭제
DELETE FROM dataexport;