-- ------------------------------------------------
-- SoD dashboard tables additions
-- Created 20141126
-- ------------------------------------------------

CREATE TABLE IF NOT EXISTS `sod_dashboard_groupcount_roles` (
  `date` date NOT NULL,
  `system` varchar(8) NOT NULL,
  `client` varchar(3) NOT NULL,
  `group_id` int(11) NOT NULL,
  `rule_type` enum('crit_role','crit_tcode','sod_role','sod_func') NOT NULL,
  `count` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`date`,`group_id`,`rule_type`,`system`,`client`)
);
CREATE TABLE IF NOT EXISTS `sod_dashboard_groupcount_users` (
  `date` date NOT NULL,
  `system` varchar(8) NOT NULL,
  `client` varchar(3) NOT NULL,
  `group_id` int(11) NOT NULL,
  `rule_type` enum('crit_role','crit_tcode','sod_role','sod_func') NOT NULL,
  `count` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`date`,`group_id`,`rule_type`,`system`,`client`)
);
CREATE TABLE IF NOT EXISTS `sod_dashboard_topfiverisks` (
  `date` date NOT NULL,
  `system` varchar(8) NOT NULL,
  `client` varchar(3) NOT NULL,
  `risk0` int(11) NOT NULL,
  `count0` int(11) NOT NULL DEFAULT '0',
  `risk1` int(11) NOT NULL,
  `count1` int(11) NOT NULL DEFAULT '0',
  `risk2` int(11) NOT NULL,
  `count2` int(11) NOT NULL DEFAULT '0',
  `risk3` int(11) NOT NULL,
  `count3` int(11) NOT NULL DEFAULT '0',
  `risk4` int(11) NOT NULL,
  `count4` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`date`,`system`,`client`)
);
CREATE TABLE IF NOT EXISTS `sod_dashboard_toptwentyusers` (
  `date` date NOT NULL,
  `system` varchar(8) NOT NULL,
  `client` varchar(3) NOT NULL,
  `user0` varchar(12) DEFAULT NULL,
  `count0` int(11) NOT NULL DEFAULT '0',
  `user1` varchar(12) DEFAULT NULL,
  `count1` int(11) NOT NULL DEFAULT '0',
  `user2` varchar(12) DEFAULT NULL,
  `count2` int(11) NOT NULL DEFAULT '0',
  `user3` varchar(12) DEFAULT NULL,
  `count3` int(11) NOT NULL DEFAULT '0',
  `user4` varchar(12) DEFAULT NULL,
  `count4` int(11) NOT NULL DEFAULT '0',
  `user5` varchar(12) DEFAULT NULL,
  `count5` int(11) NOT NULL DEFAULT '0',
  `user6` varchar(12) DEFAULT NULL,
  `count6` int(11) NOT NULL DEFAULT '0',
  `user7` varchar(12) DEFAULT NULL,
  `count7` int(11) NOT NULL DEFAULT '0',
  `user8` varchar(12) DEFAULT NULL,
  `count8` int(11) NOT NULL DEFAULT '0',
  `user9` varchar(12) DEFAULT NULL,
  `count9` int(11) NOT NULL DEFAULT '0',
  `user10` varchar(12) DEFAULT NULL,
  `count10` int(11) NOT NULL DEFAULT '0',
  `user11` varchar(12) DEFAULT NULL,
  `count11` int(11) NOT NULL DEFAULT '0',
  `user12` varchar(12) DEFAULT NULL,
  `count12` int(11) NOT NULL DEFAULT '0',
  `user13` varchar(12) DEFAULT NULL,
  `count13` int(11) NOT NULL DEFAULT '0',
  `user14` varchar(12) DEFAULT NULL,
  `count14` int(11) NOT NULL DEFAULT '0',
  `user15` varchar(12) DEFAULT NULL,
  `count15` int(11) NOT NULL DEFAULT '0',
  `user16` varchar(12) DEFAULT NULL,
  `count16` int(11) NOT NULL DEFAULT '0',
  `user17` varchar(12) DEFAULT NULL,
  `count17` int(11) NOT NULL DEFAULT '0',
  `user18` varchar(12) DEFAULT NULL,
  `count18` int(11) NOT NULL DEFAULT '0',
  `user19` varchar(12) DEFAULT NULL,
  `count19` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`date`,`system`,`client`)
);


