--
-- Copyright (c) 2022 SUSE LLC
--
-- This software is licensed to you under the GNU General Public License,
-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-- along with this software; if not, see
-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
--

COMMENT ON TABLE XccdScanResult
  IS 'The list of results for a SCAP scan';

COMMENT ON COLUMN XccdScanResult.mgm_id
  IS 'The id of the BRAND_NAME instance that contains this data';
COMMENT ON COLUMN XccdScanResult.scan_id
  IS 'The id of the security scan';
COMMENT ON COLUMN XccdScanResult.rule_id
  IS 'The id of the rule result';
COMMENT ON COLUMN XccdScanResult.ident_id
  IS 'The id of the rule';
COMMENT ON COLUMN XccdScanResult.idref
  IS 'The reference of the rule';
COMMENT ON COLUMN XccdScanResult.rulesystem
  IS 'The name of the rule system';
COMMENT ON COLUMN XccdScanResult.system_id
  IS 'The id of the system';
COMMENT ON COLUMN XccdScanResult.ident
  IS 'The identifier of this rule';
COMMENT ON COLUMN XccdScanResult.result
  IS 'The result of the scan for this rule';
COMMENT ON COLUMN XccdScanResult.synced_date
  IS 'The timestamp of when this data was last refreshed.';

ALTER TABLE XccdScanResult
    ADD CONSTRAINT XccdScanResult_scan_fkey FOREIGN KEY (mgm_id, scan_id) REFERENCES XccdScan(mgm_id, scan_id),
    ADD CONSTRAINT XccdScanResult_system_fkey FOREIGN KEY (mgm_id, system_id) REFERENCES System(mgm_id, system_id);
