-- ------------------------------------------------
-- Improved composite role handling.
-- Created 20131022
-- ------------------------------------------------

CREATE TABLE IF NOT EXISTS `um_role_comp` (
  `system` VARCHAR(8) NULL ,
  `client` CHAR(3) NULL ,
  `composite` INT(11) NOT NULL ,
  `single` INT(11) NOT NULL ,
  `um_delete` TINYINT(4) NULL ,
  PRIMARY KEY (`composite`, `single`) ,
  INDEX `sys_cli` (`client` ASC, `system` ASC) ,
  INDEX `del` (`um_delete` ASC) 
);

ALTER TABLE `um_user_role`
  ADD COLUMN `direct` TINYINT(4) NOT NULL DEFAULT 1  AFTER `role_id`;
