--
-- 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 AccountGroup
  IS 'The list of groups a user is a member of';

COMMENT ON COLUMN AccountGroup.mgm_id
  IS 'The id of the BRAND_NAME instance that contains this data';
COMMENT ON COLUMN AccountGroup.account_id
  IS 'The id of the user account';
COMMENT ON COLUMN AccountGroup.account_group_id
  IS 'The id of the user group this account belongs to';
COMMENT ON COLUMN AccountGroup.username
  IS 'The username used to login';
COMMENT ON COLUMN AccountGroup.account_group_name
  IS 'The name of this user group';
COMMENT ON COLUMN AccountGroup.account_group_type_id
  IS 'The identifier of the group type';
COMMENT ON COLUMN AccountGroup.account_group_type_name
  IS 'The descriptive name of the group type';
COMMENT ON COLUMN AccountGroup.account_group_type_label
  IS 'The unique label of the group type';
COMMENT ON COLUMN AccountGroup.synced_date
  IS 'The timestamp of when this data was last refreshed.';

ALTER TABLE AccountGroup
  ADD CONSTRAINT AccountGroup_account_fkey FOREIGN KEY (mgm_id, account_id) REFERENCES Account(mgm_id, account_id);
