--
-- 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 SystemAction
  IS 'The list of the actions performed on a system';

COMMENT ON COLUMN SystemAction.mgm_id
  IS 'The id of the BRAND_NAME instance that contains this data';
COMMENT ON COLUMN SystemAction.system_id
  IS 'The id of the system';
COMMENT ON COLUMN SystemAction.action_id
  IS 'The id of the action';
COMMENT ON COLUMN SystemAction.hostname
  IS 'The hostname of the system';
COMMENT ON COLUMN SystemAction.scheduler_id
  IS 'The id of the account who scheduled the action';
COMMENT ON COLUMN SystemAction.scheduler_username
  IS 'The username of the account who scheduled the action';
COMMENT ON COLUMN SystemAction.earliest_action
  IS 'The earliest time this action was schedule for execution';
COMMENT ON COLUMN SystemAction.archived
  IS 'True if the action is archived';
COMMENT ON COLUMN SystemAction.pickup_time
  IS 'When this action was picked up by the scheduling system';
COMMENT ON COLUMN SystemAction.completion_time
  IS 'When this action was completed';
COMMENT ON COLUMN SystemAction.action_name
  IS 'The name of the action';
COMMENT ON COLUMN SystemAction.status
  IS 'The current status of the action. Possible values Queued, Picked Up, Completed, Failed';
COMMENT ON COLUMN SystemAction.event
  IS 'The type of event triggered by this action';
COMMENT ON COLUMN SystemAction.event_data
  IS 'Additional information related to the event triggered by this action';
COMMENT ON COLUMN SystemAction.synced_date
  IS 'The timestamp of when this data was last refreshed.';

ALTER TABLE SystemAction
    ADD CONSTRAINT SystemAction_system_fkey FOREIGN KEY (mgm_id, system_id) REFERENCES System(mgm_id, system_id);
