SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
-- Table structure for table `actions`
`name` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL,
`Description` text COLLATE utf8mb4_unicode_ci NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='List of possible actions';
-- Dumping data for table `actions`
INSERT INTO `actions` VALUES
('accept_requests', b'0011000100110010', 'Accept the request of my team members'),
('admin_menu', b'0011000100110010', 'View admin menu'),
('change_password', b'0011000100110010', 'Change password'),
('create_leaves', b'0011000100110010', 'Create a new user leave request'),
('create_user', b'0011000100110010', 'Create a new user'),
('delete_user', b'0011000100110010', 'Delete an existing user'),
('edit_leaves', b'0011000100110010', 'Edit a leave request'),
('edit_settings', b'0011000100110010', 'Edit application settings'),
('edit_user', b'0011000100110010', 'Edit a user'),
('export_leaves', b'0011000100110010', 'Export the list of leave requests into an Excel file'),
('export_user', b'0011000100110010', 'Export the list of users into an Excel file'),
('hr_menu', b'0011000100110010', 'View HR menu'),
('individual_calendar', b'0011000100110010', 'View my leaves in a calendar'),
('list_leaves', b'0011000100110010', 'List my leave requests'),
('list_requests', b'0011000100110010', 'List the request of my team members'),
('list_users', b'0011000100110010', 'List users'),
('reject_requests', b'0011000100110010', 'Reject the request of my team members'),
('reset_password', b'0011000100110010', 'Modifiy the password of another user'),
('team_calendar', b'0011000100110010', 'View the leaves of my team in a calendar'),
('update_user', b'0011000100110010', 'Update a user'),
('view_leaves', b'0011000100110010', 'View the details of a leave request'),
('view_user', b'0011000100110010', 'View user''s details');
-- --------------------------------------------------------
-- Table structure for table `ci_sessions`
CREATE TABLE `ci_sessions` (
`id` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL,
`ip_address` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL,
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
KEY `ci_sessions_timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='CodeIgniter sessions (you can empty this table without consequence)';
-- --------------------------------------------------------
-- Table structure for table `contracts`
CREATE TABLE `contracts` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier of a contract',
`name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Name of the contract',
`startentdate` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Day and month numbers of the left boundary',
`endentdate` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Day and month numbers of the right boundary',
`weekly_duration` int(11) DEFAULT NULL COMMENT 'Approximate duration of work per week (in minutes)',
`daily_duration` int(11) DEFAULT NULL COMMENT 'Approximate duration of work per day and (in minutes)',
`default_leave_type` int(11) DEFAULT NULL COMMENT 'default leave type for the contract (overwrite default type set in config file).',
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='A contract groups employees having the same days off and entitlement rules' AUTO_INCREMENT=2 ;
-- Dumping data for table `contracts`
INSERT INTO `contracts` VALUES
(1, 'Global', '01/01', '12/31', 2400, 480, 1);
-- --------------------------------------------------------
-- Table structure for table `dayoffs`
`id` int(11) NOT NULL AUTO_INCREMENT,
`contract` int(11) NOT NULL COMMENT 'Contract id',
`date` date NOT NULL COMMENT 'Date of the day off',
`type` int(11) NOT NULL COMMENT 'Half or full day',
`title` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Description of day off',
KEY `contract` (`contract`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='List of non working days' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- Table structure for table `delegations`
CREATE TABLE `delegations` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Id of delegation',
`manager_id` int(11) NOT NULL COMMENT 'Manager wanting to delegate',
`delegate_id` int(11) NOT NULL COMMENT 'Employee having the delegation',
KEY `manager_id` (`manager_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Delegation of approval' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- Table structure for table `entitleddays`
CREATE TABLE `entitleddays` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier of an entitlement',
`contract` int(11) DEFAULT NULL COMMENT 'If entitlement is credited to a contract, Id of contract',
`employee` int(11) DEFAULT NULL COMMENT 'If entitlement is credited to an employee, Id of employee',
`overtime` int(11) DEFAULT NULL COMMENT 'Optional Link to an overtime request, if the credit is due to an OT',
`startdate` date DEFAULT NULL COMMENT 'Left boundary of the credit validity',
`enddate` date DEFAULT NULL COMMENT 'Right boundary of the credit validity. Duration cannot exceed one year',
`type` int(11) NOT NULL COMMENT 'Leave type',
`days` decimal(10,2) NOT NULL COMMENT 'Number of days (can be negative so as to deduct/adjust entitlement)',
`description` text COLLATE utf8mb4_unicode_ci COMMENT 'Description of a credit / debit (entitlement / adjustment)',
KEY `contract` (`contract`),
KEY `employee` (`employee`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Add or substract entitlement on employees or contracts (can be the result of an OT)' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- Table structure for table `excluded_types`
CREATE TABLE `excluded_types` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Id of exclusion',
`contract_id` int(11) NOT NULL COMMENT 'Id of contract',
`type_id` int(11) NOT NULL COMMENT 'Id of leave ype to be excluded to the contract',
KEY `contract_id` (`contract_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Exclude a leave type from a contract' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- Table structure for table `leaves`
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier of the leave request',
`startdate` date DEFAULT NULL COMMENT 'Start date of the leave request',
`enddate` date DEFAULT NULL COMMENT 'End date of the leave request',
`status` int(11) DEFAULT NULL COMMENT 'Identifier of the status of the leave request (Requested, Accepted, etc.). See status table.',
`employee` int(11) DEFAULT NULL COMMENT 'Employee requesting the leave request',
`cause` text COLLATE utf8mb4_unicode_ci COMMENT 'Reason of the leave request',
`startdatetype` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Morning/Afternoon',
`enddatetype` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Morning/Afternoon',
`duration` decimal(10,3) DEFAULT NULL COMMENT 'Length of the leave request',
`type` int(11) DEFAULT NULL COMMENT 'Identifier of the type of the leave request (Paid, Sick, etc.). See type table.',
`comments` text COLLATE utf8mb4_unicode_ci COMMENT 'Comments on leave request (JSon)',
`document` blob COMMENT 'Optional supporting document',
KEY `employee` (`employee`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Leave requests' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- Table structure for table `leaves_history`
CREATE TABLE `leaves_history` (
`startdate` date DEFAULT NULL,
`enddate` date DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`employee` int(11) DEFAULT NULL,
`cause` text COLLATE utf8mb4_unicode_ci,
`startdatetype` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`enddatetype` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`duration` decimal(10,2) DEFAULT NULL,
`type` int(11) DEFAULT NULL,
`comments` text COLLATE utf8mb4_unicode_ci COMMENT 'Comments on leave request',
`document` blob COMMENT 'Optional supporting document',
`change_id` int(11) NOT NULL AUTO_INCREMENT,
`change_type` int(11) NOT NULL,
`changed_by` int(11) NOT NULL,
`change_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`change_id`),
KEY `changed_by` (`changed_by`),
KEY `change_date` (`change_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='List of changes in leave requests table' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- Table structure for table `oauth_access_tokens`
CREATE TABLE `oauth_access_tokens` (
`access_token` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(255) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`scope` varchar(2000) DEFAULT NULL,
PRIMARY KEY (`access_token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- Table structure for table `oauth_applications`
CREATE TABLE `oauth_applications` (
`user` int(11) NOT NULL COMMENT 'Identifier of Jorani user',
`client_id` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Identifier of an application using OAuth2',
KEY `client_id` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='List of allowed OAuth2 applications';
-- --------------------------------------------------------
-- Table structure for table `oauth_authorization_codes`
CREATE TABLE `oauth_authorization_codes` (
`authorization_code` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(255) DEFAULT NULL,
`redirect_uri` varchar(2000) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`scope` varchar(2000) DEFAULT NULL,
PRIMARY KEY (`authorization_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- Table structure for table `oauth_clients`
CREATE TABLE `oauth_clients` (
`client_id` varchar(80) NOT NULL,
`client_secret` varchar(80) DEFAULT NULL,
`redirect_uri` varchar(2000) NOT NULL,
`grant_types` varchar(80) DEFAULT NULL,
`scope` varchar(100) DEFAULT NULL,
`user_id` varchar(80) DEFAULT NULL,
PRIMARY KEY (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- Table structure for table `oauth_jwt`
CREATE TABLE `oauth_jwt` (
`client_id` varchar(80) NOT NULL,
`subject` varchar(80) DEFAULT NULL,
`public_key` varchar(2000) DEFAULT NULL,
PRIMARY KEY (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- Table structure for table `oauth_refresh_tokens`
CREATE TABLE `oauth_refresh_tokens` (
`refresh_token` varchar(40) NOT NULL,
`client_id` varchar(80) NOT NULL,
`user_id` varchar(255) DEFAULT NULL,
`expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`scope` varchar(2000) DEFAULT NULL,
PRIMARY KEY (`refresh_token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- Table structure for table `oauth_scopes`
CREATE TABLE `oauth_scopes` (
`is_default` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- Table structure for table `oauth_users`
CREATE TABLE `oauth_users` (
`username` varchar(255) NOT NULL,
`password` varchar(2000) DEFAULT NULL,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- Table structure for table `organization`
CREATE TABLE `organization` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier of the department',
`name` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Name of the department',
`parent_id` int(11) DEFAULT NULL COMMENT 'Parent department (or -1 if root)',
`supervisor` int(11) DEFAULT NULL COMMENT 'This user will receive a copy of accepted and rejected leave requests',
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Tree of the organization' AUTO_INCREMENT=1 ;
-- Dumping data for table `organization`
INSERT INTO `organization` VALUES
(0, 'LMS root', -1, NULL);
-- --------------------------------------------------------
-- Table structure for table `org_lists`
CREATE TABLE `org_lists` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier of a list',
`user` int(11) NOT NULL COMMENT ' Identifier of Jorani user owning the list',
`name` varchar(512) COLLATE utf8mb4_unicode_ci NOT NULL,
KEY `org_lists_user` (`user`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Custom lists of employees are an alternative to organization' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- Table structure for table `org_lists_employees`
CREATE TABLE `org_lists_employees` (
`list` int(11) NOT NULL COMMENT 'Id of the list',
`user` int(11) NOT NULL COMMENT 'id of an employee',
`orderlist` int(11) NOT NULL COMMENT 'order in the list',
KEY `org_list_id` (`list`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Children table of org_lists (custom list of employees)';
-- --------------------------------------------------------
-- Table structure for table `overtime`
CREATE TABLE `overtime` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier of the overtime request',
`employee` int(11) NOT NULL COMMENT 'Employee requesting the OT',
`date` date NOT NULL COMMENT 'Date when the OT was done',
`duration` decimal(10,3) NOT NULL COMMENT 'Duration of the OT',
`cause` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Reason why the OT was done',
`status` int(11) NOT NULL COMMENT 'Status of OT (Planned, Requested, Accepted, Rejected)',
KEY `employee` (`employee`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Overtime worked (extra time)' AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- Table structure for table `parameters`
CREATE TABLE `parameters` (
`name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
`scope` int(11) NOT NULL COMMENT 'Either global(0) or user(1) scope',
`value` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'PHP/serialize value',
`entity_id` text COLLATE utf8mb4_unicode_ci COMMENT 'Entity ID (eg. user id) to which the parameter is applied',
KEY `param_name` (`name`,`scope`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Application parameters';
-- --------------------------------------------------------
-- Table structure for table `positions`
CREATE TABLE `positions` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier of the position',
`name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Name of the position',
`description` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Description of the position',
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Position (job position) in the organization' AUTO_INCREMENT=2 ;
-- Dumping data for table `positions`
INSERT INTO `positions` VALUES
(1, 'Employee', 'Employee.');
-- --------------------------------------------------------
-- Table structure for table `roles`
`name` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Roles in the application (system table)';
-- Dumping data for table `roles`
INSERT INTO `roles` VALUES
-- --------------------------------------------------------
-- Table structure for table `status`
`name` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Status of the Leave Request (system table)';
-- Dumping data for table `status`
INSERT INTO `status` VALUES
-- --------------------------------------------------------
-- Table structure for table `types`
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier of the type',
`name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Name of the leave type',
`acronym` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Acronym of the leave type',
`deduct_days_off` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Deduct days off when computing the balance of the leave type',
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='List of leave types (LoV table)' AUTO_INCREMENT=6 ;
-- Dumping data for table `types`
INSERT INTO `types` VALUES
(0, 'compensate', NULL, 0),
(1, 'paid leave', NULL, 0),
(2, 'maternity leave', NULL, 0),
(3, 'paternity leave', NULL, 0),
(4, 'special leave', NULL, 0),
(5, 'Sick leave', NULL, 0);
-- --------------------------------------------------------
-- Table structure for table `users`