-- ------------------------------------------------
-- DB updates for new SoD Roles
-- Created 20141217
-- ------------------------------------------------

ALTER TABLE `sod_rule`
  CHANGE COLUMN `rule_type` `rule_type` ENUM('crit_role','crit_tcode','sod_role','sod_func','sod_role2') NOT NULL;

ALTER TABLE `sod_group` 
  CHANGE COLUMN `rule_type` `rule_type` ENUM('crit_role','crit_tcode','sod_role','sod_func','sod_role2') NULL DEFAULT NULL ;

CREATE TABLE IF NOT EXISTS `sod_sod_role2` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `side` ENUM('A', 'B') NOT NULL,
  `role_id` int(11) DEFAULT NULL,
  `rule_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `rule_side` (`rule_id`, `side`)
);

