CREATE TABLE `EXTRA_WORK_REQUEST` (
  `ID_INTERNAL` int(11) unsigned NOT NULL auto_increment,
  `KEY_ASSIDUOUSNESS` int(11) NOT NULL,
  `KEY_WORKING_UNIT` int(11) NOT NULL,
  `YEAR_MONTH` VARCHAR(24) NOT NULL,
  `NIGHT_HOURS` int(11) DEFAULT NULL,
  `EXTRA_NIGHT_HOURS` int(11) DEFAULT NULL,
  `EXTRA_NIGHT_DAYS` int(11) DEFAULT NULL,
  `HOLIDAY_HOURS` int(11) DEFAULT NULL,
  `SATURDAY_HOURS` int(11) DEFAULT NULL,
  `SUNDAY_HOURAS` int(11) DEFAULT NULL,
  `WORKDAY_HOURS` int(11) DEFAULT NULL,  
  `ADD_TO_VACATIONS` TINYINT(1) DEFAULT NULL,
  `ADD_TO_WEEK_REST_TIME` TINYINT(1) DEFAULT NULL,
  `LAST_MODIFIED_DATE` DATETIME NOT NULL default '0000-00-00 00:00:00',
  `KEY_MODIFIED_BY` int(11) unsigned default NULL,
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL default '1',
  PRIMARY KEY  (`ID_INTERNAL`),
  UNIQUE KEY `u1` (`KEY_ASSIDUOUSNESS`, `YEAR_MONTH`)
) ENGINE=InnoDB;


CREATE TABLE `EXTRA_WORK_AUTHORIZATION` (
  `ID_INTERNAL` int(11) unsigned NOT NULL auto_increment,
  `KEY_WORKING_UNIT` int(11) NOT NULL,
  `KEY_PAYING_UNIT` int(11) NOT NULL,
  `BEGIN_DATE` varchar(50) NOT NULL,
  `END_DATE` varchar(50) NOT NULL,
  `LAST_MODIFIED_DATE` DATETIME NOT NULL default '0000-00-00 00:00:00',
  `KEY_MODIFIED_BY` int(11) unsigned default NULL,
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL default '1',
  PRIMARY KEY  (`ID_INTERNAL`),
  UNIQUE KEY `u1` (`KEY_WORKING_UNIT`, `KEY_PAYING_UNIT`, `BEGIN_DATE`,`END_DATE`)
) ENGINE=InnoDB;

CREATE TABLE `EMPLOYEE_EXTRA_WORK_AUTHORIZATION` (
  `ID_INTERNAL` int(11) unsigned NOT NULL auto_increment,
  `KEY_EXTRA_WORK_AUTHORIZATION` int(11) NOT NULL,
  `KEY_ASSIDUOUSNESS` int(11) NOT NULL,
  `NORMAL_EXTRA_WORK` BIT NOT NULL default 0,
  `NORMAL_EXTRA_WORK_PLUS_TWO_HOURS` BIT NOT NULL default 0,
  `NORMAL_EXTRA_WORK_PLUS_ONE_HUNDRED_HOURS` BIT NOT NULL default 0,
  `NIGHT_EXTRA_WORK` BIT NOT NULL default 0,
  `WEEKLY_REST_EXTRA_WORK` BIT NOT NULL default 0,
  `AUXILIAR_PERSONEL` BIT NOT NULL default 0,
  `EXECUTIVE_AUXILIAR_PERSONEL` BIT NOT NULL default 0,
  `LAST_MODIFIED_DATE` DATETIME NOT NULL default '0000-00-00 00:00:00',
  `KEY_MODIFIED_BY` int(11) unsigned default NULL,
  `KEY_ROOT_DOMAIN_OBJECT` int(11) NOT NULL default '1',
  PRIMARY KEY  (`ID_INTERNAL`),
  UNIQUE KEY `u1` (`KEY_EXTRA_WORK_AUTHORIZATION`, `KEY_ASSIDUOUSNESS`)
) ENGINE=InnoDB;