/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'itemreference` ( `itemreference_id` int(11) NOT NULL AUTO_INCREMENT, `itemreference_name` varchar(30) DEFAULT NULL, `itemreference_desc` varchar(256) DEFAULT NULL, PRIMARY KEY (`itemreference_id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); break; } }
/** * Get all groups * * This function gets all groups in a range * * @param array $filter Filter for search results * @param int $offset Offset for first account * @param int $limit Limit for results * * @return array * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function getList($filter = null, $offset = 0, $limit = 100) { $result = null; switch ($this->dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $sth = $this->dbPool->get('core')->con->prepare('SELECT SQL_CALC_FOUND_ROWS * FROM `' . $this->dbPool->get('core')->prefix . 'group` LIMIT ' . $offset . ',' . $limit); $sth->execute(); $result['list'] = $sth->fetchAll(); $sth = $this->dbPool->get('core')->con->prepare('SELECT FOUND_ROWS();'); $sth->execute(); $result['count'] = $sth->fetchAll()[0][0]; break; } return $result; }
/** * Create dummy data * * @param array $toDummy Dummy data array * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function installDummy($toDummy) { $this->dbPool->get('core')->con->beginTransaction(); $a = "INSERT INTO `" . $this->dbPool->get('core')->prefix . "account` (`status`, `type`, `lactive`, `created`, `changed`) VALUES"; $b = "INSERT INTO `" . $this->dbPool->get('core')->prefix . "account_data` (`login`, `name1`, `name2`, `name3`, `password`, `email`, `tries`, `account`) VALUES"; $c = "INSERT INTO `" . $this->dbPool->get('core')->prefix . "account_group` (`group`, `account`) VALUES"; $valA = ''; $valB = ''; $valC = ''; for ($i = 2; $i < 9998; $i++) { $valA .= " (" . rand(0, 1) . ", " . rand(0, 3) . ", '0000-00-00 00:00:00', '" . \phpOMS\Utils\RnG\DateTime::generateDateTime('2005-12-10', '2014-12-31')->format('Y-m-d H:i:s') . "', " . rand(0, 1) . "),"; $valB .= " ('" . strtolower(\phpOMS\Utils\RnG\Name::generateName(['male', 'female'])) . "', '" . \phpOMS\Utils\RnG\Name::generateName(['male', 'female']) . "', '" . \phpOMS\Utils\RnG\Name::generateName(['family']) . "', 'Orange Management', 'yellowOrange', '" . \phpOMS\Utils\RnG\Name::generateName(['male', 'female']) . "@email.com', " . rand(0, 5) . ", " . $i . "),"; $valC .= " (1000101000, 1),"; } $valA = rtrim($valA, ','); $valB = rtrim($valB, ','); $valC = rtrim($valC, ','); $this->dbPool->get('core')->con->prepare($a . $valA)->execute(); $this->dbPool->get('core')->con->prepare($b . $valB)->execute(); $this->dbPool->get('core')->con->prepare($c . $valC)->execute(); $this->dbPool->get('core')->con->commit(); foreach ($toDummy as $dummy) { \phpOMS\Install\DummyFactory::generate($this->dbPool, $dummy); } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'marketing_promotion` ( `marketing_promotion_id` int(11) NOT NULL AUTO_INCREMENT, `marketing_promotion_name` varchar(30) NOT NULL, `marketing_promotion_description` text DEFAULT NULL, `marketing_promotion_start` datetime DEFAULT NULL, `marketing_promotion_end` datetime DEFAULT NULL, `marketing_promotion_type` tinyint(1) DEFAULT NULL, PRIMARY KEY (`marketing_promotion_id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); break; } }
/** * Load navigation based on request * * @param string[] $request Request hashes * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ private function load($request) { if (!$this->nav) { $temp_nav = null; $this->nav = []; $uri_hash = $request; $uri_pdo = ''; $i = 1; foreach ($uri_hash as $hash) { $uri_pdo .= ':pid' . $i . ','; $i++; } $uri_pdo = rtrim($uri_pdo, ','); $sth = $this->dbPool->get('core')->con->prepare('SELECT * FROM `' . $this->dbPool->get('core')->prefix . 'nav` WHERE `nav_pid` IN(' . $uri_pdo . ') ORDER BY `nav_order` ASC'); $i = 1; foreach ($uri_hash as $hash) { $sth->bindValue(':pid' . $i, $hash, \PDO::PARAM_STR); $i++; } $sth->execute(); $temp_nav = $sth->fetchAll(); foreach ($temp_nav as $link) { $this->nav[$link['nav_type']][$link['nav_subtype']][$link['nav_id']] = $link; } } }
/** * Init cache * * @param mixed $options Options used to initialize the different caching types * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function init($options = null) { if ($options === null) { /* This is costing me 1ms, maybe init settings first cause i'm making another settings call later on -> same call 2 times */ $sth = $this->dbPool->get('core')->con->prepare('SELECT `content` FROM `' . $this->dbPool->get('core')->prefix . 'settings` WHERE `id` = 1000000015'); $sth->execute(); $cache_data = $sth->fetchAll(); $this->setOption('cache:type', (int) $cache_data[0][0]); } else { $this->options = $options; } }
/** * Install navigation element * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $data Link info * @param int $parent Parent element (default is 0 for none) * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ private static function installLink($dbPool, $data, $parent = 0) { $sth = $dbPool->get('core')->con->prepare('INSERT INTO `' . $dbPool->get('core')->prefix . 'nav` (`nav_id`, `nav_pid`, `nav_name`, `nav_type`, `nav_subtype`, `nav_icon`, `nav_uri`, `nav_from`, `nav_order`, `nav_parent`, `nav_permission`) VALUES (:id, :pid, :name, :type, :subtype, :icon, :uri, :from, :order, :parent, :perm);'); $sth->bindValue(':id', $data['id'], \PDO::PARAM_INT); $sth->bindValue(':pid', $data['pid'], \PDO::PARAM_STR); $sth->bindValue(':name', $data['name'], \PDO::PARAM_STR); $sth->bindValue(':type', $data['type'], \PDO::PARAM_INT); $sth->bindValue(':subtype', $data['subtype'], \PDO::PARAM_INT); $sth->bindValue(':icon', $data['icon'], \PDO::PARAM_STR); $sth->bindValue(':uri', $data['uri'], \PDO::PARAM_STR); $sth->bindValue(':from', $data['from'], \PDO::PARAM_INT); $sth->bindValue(':order', $data['order'], \PDO::PARAM_INT); $sth->bindValue(':parent', $parent, \PDO::PARAM_INT); $sth->bindValue(':perm', $data['permission'], \PDO::PARAM_INT); $sth->execute(); $lastInsertID = $dbPool->get('core')->con->lastInsertId(); foreach ($data['children'] as $link) { $parent = $link['parent'] == null ? $lastInsertID : $link['parent']; self::installLink($dbPool, $link, $parent); } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'payment_info` ( `payment_info_id` int(11) NOT NULL AUTO_INCREMENT, `payment_info_account` int(11) DEFAULT NULL, PRIMARY KEY (`payment_info_id`), KEY `payment_info_account` (`payment_info_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'payment_info` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'payment_info_ibfk_1` FOREIGN KEY (`payment_info_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'billing_invoice_element` ADD KEY `billing_invoice_element_article` (`billing_invoice_element_article`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'billing_invoice_element_ibfk_2` FOREIGN KEY (`billing_invoice_element_article`) REFERENCES `' . $dbPool->get('core')->prefix . 'itemreference` (`itemreference_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'arrival` ADD KEY `arrival_media` (`arrival_media`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'arrival_ibfk_3` FOREIGN KEY (`arrival_media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_staff` ( `hr_staff_id` int(11) NOT NULL AUTO_INCREMENT, `hr_staff_status` tinyint(2) DEFAULT NULL, `hr_staff_account` int(11) DEFAULT NULL, PRIMARY KEY (`hr_staff_id`), KEY `hr_staff_account` (`hr_staff_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_staff` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_staff_ibfk_1` FOREIGN KEY (`hr_staff_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_staff_history` ( `hr_staff_history_id` int(11) NOT NULL AUTO_INCREMENT, `hr_staff_history_staff` int(11) DEFAULT NULL, `hr_staff_history_position` int(11) DEFAULT NULL, `hr_staff_history_department` int(11) DEFAULT NULL, `hr_staff_history_start` datetime DEFAULT NULL, `hr_staff_history_end` datetime DEFAULT NULL, PRIMARY KEY (`hr_staff_history_id`), KEY `hr_staff_history_staff` (`hr_staff_history_staff`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_staff_history` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_staff_history_ibfk_1` FOREIGN KEY (`hr_staff_history_staff`) REFERENCES `' . $dbPool->get('core')->prefix . 'hr_staff` (`hr_staff_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_staff_contract` ( `hr_staff_contract_id` int(11) NOT NULL AUTO_INCREMENT, `hr_staff_contract_stype` tinyint(1) DEFAULT NULL, `hr_staff_contract_salary` decimal(8,2) DEFAULT NULL, `hr_staff_contract_cformingbenefits` decimal(8,2) DEFAULT NULL, `hr_staff_contract_working_hours` int(11) DEFAULT NULL, `hr_staff_contract_vacation` tinyint(3) DEFAULT NULL, `hr_staff_contract_vtype` tinyint(3) DEFAULT NULL, `hr_staff_contract_personal_time` tinyint(3) DEFAULT NULL, `hr_staff_contract_start` datetime DEFAULT NULL, `hr_staff_contract_end` datetime DEFAULT NULL, `hr_staff_contract_employee` int(11) DEFAULT NULL, PRIMARY KEY (`hr_staff_contract_id`), KEY `hr_staff_contract_employee` (`hr_staff_contract_employee`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_staff_contract` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_staff_contract_ibfk_1` FOREIGN KEY (`hr_staff_contract_employee`) REFERENCES `' . $dbPool->get('core')->prefix . 'hr_staff` (`hr_staff_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_planning_shift` ( `HRPlanningShiftID` int(11) NOT NULL AUTO_INCREMENT, `amount` int(11) DEFAULT NULL, `position` int(11) DEFAULT NULL, `department` int(11) DEFAULT NULL, `start` datetime DEFAULT NULL, `end` datetime DEFAULT NULL, PRIMARY KEY (`HRPlanningShiftID`), KEY `department` (`department`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_planning_shift` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_planning_shift_ibfk_1` FOREIGN KEY (`department`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_department` (`business_department_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'hr_planning_staff` ( `HRPlanningStaffID` int(11) NOT NULL AUTO_INCREMENT, `person` int(11) DEFAULT NULL, `start` datetime DEFAULT NULL, `end` datetime DEFAULT NULL, `status` tinyint(1) NOT NULL, `type` tinyint(1) NOT NULL, `repeat` tinyint(1) NOT NULL, `rep_interval` tinyint(3) NOT NULL, `rep_monday` tinyint(1) NOT NULL, `rep_tuesday` tinyint(1) NOT NULL, `rep_wednesday` tinyint(1) NOT NULL, `rep_thursday` tinyint(1) NOT NULL, `rep_friday` tinyint(1) NOT NULL, `rep_saturday` tinyint(1) NOT NULL, `rep_sunday` tinyint(1) NOT NULL, PRIMARY KEY (`HRPlanningStaffID`), KEY `person` (`person`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'hr_planning_staff` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'hr_planning_staff_ibfk_1` FOREIGN KEY (`person`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_account` ( `profile_account_id` int(11) NOT NULL, `profile_account_begin` datetime NOT NULL, `profile_account_image` varchar(255) NOT NULL, `profile_account_cv` text NOT NULL, `profile_account_account` int(11) DEFAULT NULL, PRIMARY KEY (`profile_account_id`), KEY `profile_account_account` (`profile_account_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_account` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_account_ibfk_1` FOREIGN KEY (`profile_account_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_phone` ( `profile_phone_id` int(11) NOT NULL, `profile_phone_type` tinyint(2) NOT NULL, `profile_phone_number` varchar(50) NOT NULL, `profile_phone_account` int(11) NOT NULL, PRIMARY KEY (`profile_phone_id`), KEY `profile_phone_account` (`profile_phone_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_phone` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_phone_ibfk_1` FOREIGN KEY (`profile_phone_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_address` ( `profile_address_id` int(11) NOT NULL, `profile_address_type` tinyint(2) NOT NULL, `profile_address_address` varchar(50) NOT NULL, `profile_address_street` varchar(50) NOT NULL, `profile_address_city` varchar(50) NOT NULL, `profile_address_zip` varchar(50) NOT NULL, `profile_address_country` varchar(50) NOT NULL, `profile_address_account` int(11) DEFAULT NULL, PRIMARY KEY (`profile_address_id`), KEY `profile_address_account` (`profile_address_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_address` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_address_ibfk_1` FOREIGN KEY (`profile_address_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_account_relation` ( `profile_account_relation_id` int(11) NOT NULL, `profile_account_relation_type` tinyint(2) NOT NULL, `profile_account_relation_relation` int(11) DEFAULT NULL, `profile_account_relation_account` int(11) DEFAULT NULL, PRIMARY KEY (`profile_account_relation_id`), KEY `profile_account_relation_account` (`profile_account_relation_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_account_relation` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_account_relation_ibfk_1` FOREIGN KEY (`profile_account_relation_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_account_setting` ( `profile_account_setting_id` int(11) NOT NULL, `profile_account_setting_module` int(11) NOT NULL, `profile_account_setting_type` varchar(20) NOT NULL, `profile_account_setting_value` varchar(32) DEFAULT NULL, `profile_account_setting_account` int(11) DEFAULT NULL, PRIMARY KEY (`profile_account_setting_id`), KEY `profile_account_setting_account` (`profile_account_setting_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_account_setting` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_account_setting_ibfk_1` FOREIGN KEY (`profile_account_setting_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'area_manager_area` ( `area_manager_area_id` int(11) NOT NULL AUTO_INCREMENT, `area_manager_area_name` varchar(50) NOT NULL, PRIMARY KEY (`area_manager_area_id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'area_manager_account` ( `area_manager_account_id` int(11) NOT NULL AUTO_INCREMENT, `area_manager_account_start` datetime NOT NULL, `area_manager_account_end` datetime NOT NULL, `area_manager_account_account` int(11) NOT NULL, `area_manager_account_area` int(11) NOT NULL, PRIMARY KEY (`area_manager_account_id`), KEY `area_manager_account_account` (`area_manager_account_account`), KEY `area_manager_account_area` (`area_manager_account_area`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'area_manager_account` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'area_manager_account_ibfk_1` FOREIGN KEY (`area_manager_account_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'area_manager_account_ibfk_2` FOREIGN KEY (`area_manager_account_area`) REFERENCES `' . $dbPool->get('core')->prefix . 'area_manager_area` (`area_manager_area_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'chat_room` ( `chat_room_id` int(11) NOT NULL AUTO_INCREMENT, `chat_room_name` varchar(25) NOT NULL, `chat_room_password` varchar(64) NOT NULL, `chat_room_description` varchar(255) NOT NULL, `chat_room_creator` int(11) NOT NULL, `chat_room_created` datetime NOT NULL, PRIMARY KEY (`chat_room_id`), KEY `chat_room_creator` (`chat_room_creator`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'chat_room` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'chat_room_ibfk_1` FOREIGN KEY (`chat_room_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'chat_room_permission` ( `chat_room_permission_id` int(11) NOT NULL AUTO_INCREMENT, `chat_room_permission_account` int(11) NOT NULL, `chat_room_permission_room` int(11) NOT NULL, `chat_room_permission_permission` tinyint(1) NOT NULL, PRIMARY KEY (`chat_room_permission_id`), KEY `chat_room_permission_account` (`chat_room_permission_account`), KEY `chat_room_permission_room` (`chat_room_permission_room`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'chat_room_permission` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'chat_room_permission_ibfk_1` FOREIGN KEY (`chat_room_permission_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'chat_room_permission_ibfk_2` FOREIGN KEY (`chat_room_permission_room`) REFERENCES `' . $dbPool->get('core')->prefix . 'chat_room` (`chat_room_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->beginTransaction(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'task_template` ( `task_template_id` int(11) NOT NULL AUTO_INCREMENT, `task_title` varchar(30) DEFAULT NULL, `task_desc` text NOT NULL, `task_created_by` int(11) NOT NULL, `task_created_at` datetime NOT NULL, PRIMARY KEY (`task_template_id`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); /** * task_visibility = 0 or 1 * 0 everyone who ever received this task can see its current content * 1 only the current holder of a task can see its content */ $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'task` ( `task_id` int(11) NOT NULL AUTO_INCREMENT, `task_title` varchar(30) DEFAULT NULL, `task_desc` text NOT NULL, `task_plain` text NOT NULL, `task_status` tinyint(3) NOT NULL, `task_template` int(11) NOT NULL, `task_visibility` tinyint(1) NOT NULL, `task_due` datetime NOT NULL, `task_done` datetime NOT NULL, `task_creator` int(11) NOT NULL, `task_created` datetime NOT NULL, PRIMARY KEY (`task_id`), KEY `task_creator` (`task_creator`), KEY `task_template` (`task_template`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'task` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_ibfk_1` FOREIGN KEY (`task_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_ibfk_2` FOREIGN KEY (`task_template`) REFERENCES `' . $dbPool->get('core')->prefix . 'task_template` (`task_template_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'task_element` ( `task_element_id` int(11) NOT NULL AUTO_INCREMENT, `task_element_desc` text NOT NULL, `task_element_plain` text NOT NULL, `task_element_task` int(11) NOT NULL, `task_element_creator` int(11) NOT NULL, `task_element_status` tinyint(3) NOT NULL, `task_element_due` datetime NOT NULL, `task_element_forwarded` int(11) NOT NULL, `task_element_created` datetime NOT NULL, PRIMARY KEY (`task_element_id`), KEY `task_element_task` (`task_element_task`), KEY `task_element_creator` (`task_element_creator`), KEY `task_element_forwarded` (`task_element_forwarded`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'task_element` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_element_ibfk_1` FOREIGN KEY (`task_element_task`) REFERENCES `' . $dbPool->get('core')->prefix . 'task` (`task_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_element_ibfk_2` FOREIGN KEY (`task_element_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_element_ibfk_3` FOREIGN KEY (`task_element_forwarded`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'task_sub` ( `task_sub_id` int(11) NOT NULL AUTO_INCREMENT, `task_sub_title` varchar(30) DEFAULT NULL, `task_sub_desc` text NOT NULL, `task_sub_plain` text NOT NULL, `task_sub_status` tinyint(3) NOT NULL, `task_sub_due` datetime NOT NULL, `task_sub_done` datetime NOT NULL, `task_sub_creator` int(11) NOT NULL, `task_sub_created` datetime NOT NULL, `task_sub_element` int(11) NOT NULL, PRIMARY KEY (`task_sub_id`), KEY `task_sub_creator` (`task_sub_creator`), KEY `task_sub_element` (`task_sub_element`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'task_sub` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_sub_ibfk_1` FOREIGN KEY (`task_sub_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_sub_ibfk_2` FOREIGN KEY (`task_sub_element`) REFERENCES `' . $dbPool->get('core')->prefix . 'task_element` (`task_element_id`);')->execute(); $dbPool->get('core')->con->commit(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_unit` ( `riskmngmt_unit_id` int(11) NOT NULL, `riskmngmt_unit_unit` int(11) NOT NULL, `riskmngmt_unit_responsible` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_unit_id`), KEY `riskmngmt_unit_unit` (`riskmngmt_unit_unit`), KEY `riskmngmt_unit_responsible` (`riskmngmt_unit_responsible`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_unit` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_unit_ibfk_1` FOREIGN KEY (`riskmngmt_unit_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_unit` (`business_unit_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_unit_ibfk_2` FOREIGN KEY (`riskmngmt_unit_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_department` ( `riskmngmt_department_id` int(11) NOT NULL, `riskmngmt_department_parent` int(11) NOT NULL, `riskmngmt_department_responsible` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_department_id`), KEY `riskmngmt_department_parent` (`riskmngmt_department_parent`), KEY `riskmngmt_department_responsible` (`riskmngmt_department_responsible`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_department` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_department_ibfk_1` FOREIGN KEY (`riskmngmt_department_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_department` (`business_department_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_department_ibfk_2` FOREIGN KEY (`riskmngmt_department_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_category` ( `riskmngmt_category_id` int(11) NOT NULL, `riskmngmt_category_name` varchar(50) NOT NULL, `riskmngmt_category_parent` int(11) DEFAULT NULL, `riskmngmt_category_responsible` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_category_id`), KEY `riskmngmt_category_parent` (`riskmngmt_category_parent`), KEY `riskmngmt_category_responsible` (`riskmngmt_category_responsible`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_category` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_category_ibfk_1` FOREIGN KEY (`riskmngmt_category_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_category` (`riskmngmt_category_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_category_ibfk_2` FOREIGN KEY (`riskmngmt_category_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); // TODO: more (media, start, end etc...) $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_project` ( `riskmngmt_project_id` int(11) NOT NULL, `riskmngmt_project_name` varchar(50) NOT NULL, `riskmngmt_project_description` text NOT NULL, `riskmngmt_project_unit` int(11) NOT NULL, `riskmngmt_project_responsible` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_project_id`), KEY `riskmngmt_project_unit` (`riskmngmt_project_unit`), KEY `riskmngmt_project_responsible` (`riskmngmt_project_responsible`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_project` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_project_ibfk_1` FOREIGN KEY (`riskmngmt_project_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_unit` (`business_unit_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_project_ibfk_2` FOREIGN KEY (`riskmngmt_project_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); // TODO: more (media, start, end etc...) $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_process` ( `riskmngmt_process_id` int(11) NOT NULL, `riskmngmt_process_name` varchar(50) NOT NULL, `riskmngmt_process_description` text NOT NULL, `riskmngmt_process_unit` int(11) NOT NULL, `riskmngmt_process_responsible` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_process_id`), KEY `riskmngmt_process_unit` (`riskmngmt_process_unit`), KEY `riskmngmt_process_responsible` (`riskmngmt_process_responsible`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_process` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_1` FOREIGN KEY (`riskmngmt_process_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_unit` (`business_unit_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_process_ibfk_2` FOREIGN KEY (`riskmngmt_process_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` ( `riskmngmt_risk_id` int(11) NOT NULL, `riskmngmt_risk_name` varchar(50) NOT NULL, `riskmngmt_risk_description` text NOT NULL, `riskmngmt_risk_unit` int(11) NOT NULL, `riskmngmt_risk_deptartment` int(11) NOT NULL, `riskmngmt_risk_category` int(11) NOT NULL, `riskmngmt_risk_project` int(11) NOT NULL, `riskmngmt_risk_process` int(11) NOT NULL, `riskmngmt_risk_responsible` int(11) NOT NULL, `riskmngmt_risk_backup` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_risk_id`), KEY `riskmngmt_risk_unit` (`riskmngmt_risk_unit`), KEY `riskmngmt_risk_responsible` (`riskmngmt_risk_responsible`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_ibfk_1` FOREIGN KEY (`riskmngmt_risk_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_unit` (`business_unit_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_ibfk_2` FOREIGN KEY (`riskmngmt_risk_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` ( `riskmngmt_risk_object_id` int(11) NOT NULL, `riskmngmt_risk_object_name` varchar(50) NOT NULL, `riskmngmt_risk_object_risk` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_risk_object_id`), KEY `riskmngmt_risk_object_risk` (`riskmngmt_risk_object_risk`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object_ibfk_1` FOREIGN KEY (`riskmngmt_risk_object_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval` ( `riskmngmt_risk_eval_id` int(11) NOT NULL, `riskmngmt_risk_eval_val` decimal(11,4) NOT NULL, `riskmngmt_risk_eval_object` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_risk_eval_id`), KEY `riskmngmt_risk_eval_object` (`riskmngmt_risk_eval_object`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_eval` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_evaluation_ibfk_1` FOREIGN KEY (`riskmngmt_risk_eval_object`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_object` (`riskmngmt_risk_object_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media` ( `riskmngmt_risk_media_id` int(11) NOT NULL, `riskmngmt_risk_media_media` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_risk_media_id`), KEY `riskmngmt_risk_media_media` (`riskmngmt_risk_media_media`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_media_ibfk_1` FOREIGN KEY (`riskmngmt_risk_media_media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_cause` ( `riskmngmt_risk_cause_id` int(11) NOT NULL, `riskmngmt_risk_cause_name` varchar(50) NOT NULL, `riskmngmt_risk_cause_description` text NOT NULL, `riskmngmt_risk_cause_probability` smallint(6) NOT NULL, `riskmngmt_risk_cause_deptartment` int(11) NOT NULL, `riskmngmt_risk_cause_category` int(11) NOT NULL, `riskmngmt_risk_cause_risk` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_risk_cause_id`), KEY `riskmngmt_risk_cause_deptartment` (`riskmngmt_risk_cause_deptartment`), KEY `riskmngmt_risk_cause_category` (`riskmngmt_risk_cause_category`), KEY `riskmngmt_risk_cause_risk` (`riskmngmt_risk_cause_risk`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_cause` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_cause_ibfk_1` FOREIGN KEY (`riskmngmt_risk_cause_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_solution` ( `riskmngmt_risk_solution_id` int(11) NOT NULL, `riskmngmt_risk_solution_name` varchar(50) NOT NULL, `riskmngmt_risk_solution_description` text NOT NULL, `riskmngmt_risk_solution_probability` smallint(6) NOT NULL, `riskmngmt_risk_solution_effect` decimal(11,4) NOT NULL, `riskmngmt_risk_solution_cause` int(11) NOT NULL, `riskmngmt_risk_solution_risk` int(11) NOT NULL, PRIMARY KEY (`riskmngmt_risk_solution_id`), KEY `riskmngmt_risk_solution_cause` (`riskmngmt_risk_solution_cause`), KEY `riskmngmt_risk_solution_risk` (`riskmngmt_risk_solution_risk`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_solution` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_solution_ibfk_1` FOREIGN KEY (`riskmngmt_risk_solution_cause`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_cause` (`riskmngmt_risk_cause_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'riskmngmt_risk_solution_ibfk_2` FOREIGN KEY (`riskmngmt_risk_solution_risk`) REFERENCES `' . $dbPool->get('core')->prefix . 'riskmngmt_risk` (`riskmngmt_risk_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'purchase_article` ( `purchase_article_id` int(11) NOT NULL AUTO_INCREMENT, `purchase_article_item` int(11) DEFAULT NULL, PRIMARY KEY (`purchase_article_id`), KEY `purchase_article_item` (`purchase_article_item`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'purchase_article` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'purchase_article_ibfk_1` FOREIGN KEY (`purchase_article_item`) REFERENCES `' . $dbPool->get('core')->prefix . 'itemreference` (`itemreference_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'purchase_supplier` ( `purchase_supplier_id` int(11) NOT NULL AUTO_INCREMENT, `purchase_supplier_account` int(11) NOT NULL, PRIMARY KEY (`purchase_supplier_id`), KEY `account` (`purchase_supplier_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'purchase_supplier` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'purchase_supplier_ibfk_1` FOREIGN KEY (`purchase_supplier_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); // TODO: create reference between WE, RG and Order????? /* These are the invoices that get created by the purchasing department */ $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'purchase_invoice` ( `purchase_invoice_id` int(11) NOT NULL AUTO_INCREMENT, `purchase_invoice_status` tinyint(2) DEFAULT NULL, `purchase_invoice_type` tinyint(2) DEFAULT NULL, `purchase_invoice_created` datetime DEFAULT NULL, `purchase_invoice_printed` datetime DEFAULT NULL, `purchase_invoice_price` decimal(9,2) DEFAULT NULL, `purchase_invoice_currency` varchar(3) DEFAULT NULL, `purchase_invoice_creator` int(11) NOT NULL, `purchase_invoice_supplier` int(11) NOT NULL, `purchase_invoice_referer` int(11) NOT NULL, PRIMARY KEY (`purchase_invoice_id`), KEY `purchase_invoice_creator` (`purchase_invoice_creator`), KEY `purchase_invoice_supplier` (`purchase_invoice_supplier`), KEY `purchase_invoice_referer` (`purchase_invoice_referer`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'purchase_invoice` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'purchase_invoice_ibfk_1` FOREIGN KEY (`purchase_invoice_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'purchase_invoice_ibfk_2` FOREIGN KEY (`purchase_invoice_supplier`) REFERENCES `' . $dbPool->get('core')->prefix . 'purchase_supplier` (`purchase_supplier_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'purchase_invoice_ibfk_3` FOREIGN KEY (`purchase_invoice_referer`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_stock` ( `WarehousingStockID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, PRIMARY KEY (`WarehousingStockID`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_stock_location` ( `WarehousingStockLocationID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, `stock` int(11) DEFAULT NULL, PRIMARY KEY (`WarehousingStockLocationID`), KEY `stock` (`stock`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'warehousing_stock_location` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_stock_location_ibfk_1` FOREIGN KEY (`stock`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_stock` (`WarehousingStockID`);')->execute(); // TODO: complete $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_article` ( `WarehousingArticleID` int(11) NOT NULL AUTO_INCREMENT, `weight` int(11) DEFAULT NULL, `dimension` varchar(17) DEFAULT NULL, `volume` int(11) DEFAULT NULL, `lot` tinyint(1) DEFAULT NULL, `status` tinyint(2) DEFAULT NULL, PRIMARY KEY (`WarehousingArticleID`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_article_disposal` ( `WarehousingArticleID` int(11) NOT NULL AUTO_INCREMENT, `glas` int(11) DEFAULT NULL, `paper` int(11) DEFAULT NULL, `sheet` int(11) DEFAULT NULL, `aluminium` int(11) DEFAULT NULL, `synthetic` int(11) DEFAULT NULL, `cardboard` int(11) DEFAULT NULL, `composites` int(11) DEFAULT NULL, `organic` int(11) DEFAULT NULL, `pe` int(11) DEFAULT NULL, `misc` int(11) DEFAULT NULL, PRIMARY KEY (`WarehousingArticleID`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); // WE kann von client oder supplier kommen, deswegen type $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_arrival` ( `WarehousingArrivalID` int(11) NOT NULL AUTO_INCREMENT, `arrivaldate` datetime DEFAULT NULL, `from` int(11) DEFAULT NULL, `type` tinyint(1) DEFAULT NULL, `media` int(11) DEFAULT NULL, `pcondition` tinyint(1) DEFAULT NULL, `acondition` tinyint(1) DEFAULT NULL, `amount` tinyint(1) DEFAULT NULL, `checked` int(11) DEFAULT NULL, `dnote` int(11) DEFAULT NULL, PRIMARY KEY (`WarehousingArrivalID`), KEY `checked` (`checked`), KEY `dnote` (`dnote`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'warehousing_arrival` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_arrival_ibfk_1` FOREIGN KEY (`checked`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); /* info: amount will get increased and reduced based on invoices -> will result in a high amount of entries where the amount is 0 -> long lookup times for available lot lookup?! */ $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_article_stock` ( `WarehousingArticleStockID` int(11) NOT NULL AUTO_INCREMENT, `article` int(11) DEFAULT NULL, `lot` varchar(256) DEFAULT NULL, `sn` varchar(256) DEFAULT NULL, `durability` datetime DEFAULT NULL, `arrival` int(11) DEFAULT NULL, `amount` mediumint(9) DEFAULT NULL, `location` int(11) DEFAULT NULL, PRIMARY KEY (`WarehousingArticleStockID`), KEY `article` (`article`), KEY `arrival` (`arrival`), KEY `location` (`location`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'warehousing_article_stock` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_article_stock_ibfk_1` FOREIGN KEY (`article`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_article` (`WarehousingArticleID`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_article_stock_ibfk_2` FOREIGN KEY (`arrival`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_arrival` (`WarehousingArrivalID`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_article_stock_ibfk_3` FOREIGN KEY (`location`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_stock_location` (`WarehousingStockLocationID`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_arrival_transfer` ( `WarehousingArrivalTransferID` int(11) NOT NULL AUTO_INCREMENT, `location` int(11) DEFAULT NULL, `amount` int(11) DEFAULT NULL, `arrival` int(11) DEFAULT NULL, PRIMARY KEY (`WarehousingArrivalTransferID`), KEY `location` (`location`), KEY `arrival` (`arrival`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'warehousing_arrival_transfer` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_arrival_transfer_ibfk_1` FOREIGN KEY (`location`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_article_stock` (`WarehousingArticleStockID`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_arrival_transfer_ibfk_2` FOREIGN KEY (`arrival`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_arrival` (`WarehousingArrivalID`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer` ( `WarehousingArticleTransferID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, `creator` int(11) DEFAULT NULL, `created` datetime DEFAULT NULL, PRIMARY KEY (`WarehousingArticleTransferID`), KEY `creator` (`creator`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer_ibfk_1` FOREIGN KEY (`creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer_single` ( `WarehousingArticleStockID` int(11) NOT NULL AUTO_INCREMENT, `old` int(11) DEFAULT NULL, `new` int(11) DEFAULT NULL, `amount` int(11) DEFAULT NULL, `transfer` int(11) DEFAULT NULL, PRIMARY KEY (`WarehousingArticleStockID`), KEY `old` (`old`), KEY `new` (`new`), KEY `transfer` (`transfer`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer_single` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer_single_ibfk_1` FOREIGN KEY (`old`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_article_stock` (`WarehousingArticleStockID`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer_single_ibfk_2` FOREIGN KEY (`new`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_article_stock` (`WarehousingArticleStockID`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer_single_ibfk_3` FOREIGN KEY (`transfer`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_article_transfer` (`WarehousingArticleTransferID`);')->execute(); // TODO: maybe consider chaning shipCountry varchar to size 55 (based on ISO 3166-1) (same goes for sales department tables) // TODO: create shipFrom table = business address of your company (maybe multiple) // TODO: implement ups fields make sure to use multiple tables (multiple packages) $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'warehousing_shipping` ( `WarehousingShippingID` int(11) NOT NULL AUTO_INCREMENT, `shippingdate` datetime DEFAULT NULL, `shipTo` varchar(50) DEFAULT NULL, `shipFAO` varchar(30) DEFAULT NULL, `shipAddr` varchar(50) DEFAULT NULL, `shipCity` varchar(20) DEFAULT NULL, `shipState` varchar(30) DEFAULT NULL, `shipZip` varchar(20) DEFAULT NULL, `shipCountry` varchar(30) DEFAULT NULL, `shipPhone` varchar(30) DEFAULT NULL, `shipFrom` int(11) DEFAULT NULL, `carrier` varchar(30) DEFAULT NULL, `tracking` varchar(7089) DEFAULT NULL, `client` int(11) DEFAULT NULL, `invoice` int(11) DEFAULT NULL, `shipped` int(11) DEFAULT NULL, PRIMARY KEY (`WarehousingShippingID`), KEY `shipFrom` (`shipFrom`), KEY `shipped` (`shipped`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'warehousing_shipping` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_shipping_ibfk_1` FOREIGN KEY (`shipFrom`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_address` (`business_address_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'warehousing_shipping_ibfk_2` FOREIGN KEY (`shipped`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'accounting_account` ( `accounting_account_id` int(11) NOT NULL AUTO_INCREMENT, `accounting_account_name` varchar(25) NOT NULL, `accounting_account_description` varchar(255) NOT NULL, `accounting_account_type` tinyint(1) NOT NULL, `accounting_account_parent` int(11) NOT NULL, PRIMARY KEY (`accounting_account_id`), KEY `accounting_account_parent` (`accounting_account_parent`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'accounting_account` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_account_ibfk_1` FOREIGN KEY (`accounting_account_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'accounting_account` (`accounting_account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'accounting_batch` ( `accounting_batch_id` int(11) NOT NULL AUTO_INCREMENT, `accounting_batch_title` varchar(30) NOT NULL, `accounting_batch_creator` int(11) NOT NULL, `accounting_batch_created`datetime NOT NULL, `accounting_batch_type` tinyint(1) NOT NULL, PRIMARY KEY (`accounting_batch_id`), KEY `accounting_batch_creator` (`accounting_batch_creator`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'accounting_batch` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_batch_ibfk_1` FOREIGN KEY (`accounting_batch_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'accounting_posting` ( `accounting_posting_id` int(11) NOT NULL AUTO_INCREMENT, `accounting_posting_batch` int(11) NOT NULL, `accounting_posting_receipt` int(11) DEFAULT NULL, `accounting_posting_receipt_ext` int(11) DEFAULT NULL, `accounting_posting_price` decimal(11,3) NOT NULL, `accounting_posting_affiliation` datetime NOT NULL, PRIMARY KEY (`accounting_posting_id`), KEY `accounting_posting_batch` (`accounting_posting_batch`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'accounting_posting` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_posting_ibfk_1` FOREIGN KEY (`accounting_posting_batch`) REFERENCES `' . $dbPool->get('core')->prefix . 'accounting_batch` (`accounting_batch_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'accounting_posting_ele` ( `accounting_posting_ele_id` int(11) NOT NULL AUTO_INCREMENT, `accounting_posting_ele_type` tinyint(1) NOT NULL, `accounting_posting_ele_account` int(11) NOT NULL, `accounting_posting_ele_value` decimal(11,3) NOT NULL, `accounting_posting_ele_tax` tinyint(1) NOT NULL, PRIMARY KEY (`accounting_posting_ele_id`), KEY `accounting_posting_ele_account` (`accounting_posting_ele_account`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'accounting_posting_ele` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_posting_ele_ibfk_1` FOREIGN KEY (`accounting_posting_ele_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'accounting_account` (`accounting_account_id`);')->execute(); /* * type = (offer, confirmation etc.) * soptained = date of when we received the service/order (not the invoice) * check = person who checked or is supposed to check the invoice * checked = date of when the invoice got approved (no datetime = no approval) * posting referes (direct) * payment referes to this (indirect) * status { * blank * received-ok * received-notok * checked-ok * checked-notok * posted-ok * posted-notok * payed-ok * payed-notok * } */ /* * TODO: Purchasing can create. person who creates automatically get's permission for these to read. * TODO: move to different module */ /* $dbPool->get('core')->con->prepare( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'accounting_invoices_process` ( `AccountingInvoiceProcessID` int(11) NOT NULL AUTO_INCREMENT, `media` int(11) DEFAULT NULL, `type` tinyint(1) DEFAULT NULL, `supplier` int(11) DEFAULT NULL, `sname` varchar(32) DEFAULT NULL, `optained` datetime NOT NULL, `soptained` datetime NOT NULL, `refnumber` varchar(24) NOT NULL, `invoicedate` datetime NOT NULL, `internalref` int(11) NOT NULL, `due` datetime NOT NULL, `duediscount` datetime NOT NULL, `amount` decimal(11,3) NOT NULL, `amountdiscount` decimal(11,3) NOT NULL, `order` int(11) DEFAULT NULL, `arrival` int(11) DEFAULT NULL, `dnote` int(11) DEFAULT NULL, PRIMARY KEY (`AccountingInvoiceProcessID`), KEY `media` (`media`), KEY `order` (`order`), KEY `arrival` (`arrival`), KEY `dnote` (`dnote`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' )->execute(); $dbPool->get('core')->con->prepare( 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'accounting_invoices_process` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_invoices_process_ibfk_1` FOREIGN KEY (`media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_invoices_process_ibfk_2` FOREIGN KEY (`order`) REFERENCES `' . $dbPool->get('core')->prefix . 'purchase_invoices` (`PurchaseInvoiceID`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_invoices_process_ibfk_3` FOREIGN KEY (`arrival`) REFERENCES `' . $dbPool->get('core')->prefix . 'warehousing_arrival` (`WarehousingArrivalID`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_invoices_process_ibfk_4` FOREIGN KEY (`dnote`) REFERENCES `' . $dbPool->get('core')->prefix . 'purchase_dnote` (`PurchaseDnoteID`);' )->execute(); $dbPool->get('core')->con->prepare( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'accounting_invoices_status` ( `AccountingInvoiceStatusID` int(11) NOT NULL AUTO_INCREMENT, `invoice` int(11) DEFAULT NULL, `status` tinyint(1) DEFAULT NULL, `person` int(11) DEFAULT NULL, `changed` datetime DEFAULT NULL, `info` varchar(256) NOT NULL, PRIMARY KEY (`AccountingInvoiceStatusID`), KEY `invoice` (`invoice`), KEY `person` (`person`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' )->execute(); $dbPool->get('core')->con->prepare( 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'accounting_invoices_status` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_invoices_status_ibfk_1` FOREIGN KEY (`invoice`) REFERENCES `' . $dbPool->get('core')->prefix . 'accounting_invoices_process` (`AccountingInvoiceProcessID`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_invoices_status_ibfk_2` FOREIGN KEY (`person`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' )->execute(); $dbPool->get('core')->con->prepare( 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'accounting_invoices_process_permission` ( `AccountingInvoiceProcessPermissionID` int(11) NOT NULL AUTO_INCREMENT, `process` int(11) DEFAULT NULL, `person` int(11) DEFAULT NULL, `permission` int(11) DEFAULT NULL, PRIMARY KEY (`AccountingInvoiceProcessPermissionID`), KEY `person` (`person`), KEY `process` (`process`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' )->execute(); $dbPool->get('core')->con->prepare( 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'accounting_invoices_process_permission` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_invoices_process_permission_ibfk_1` FOREIGN KEY (`person`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_invoices_process_permission_ibfk_2` FOREIGN KEY (`process`) REFERENCES `' . $dbPool->get('core')->prefix . 'accounting_invoices_process` (`AccountingInvoiceProcessID`);' )->execute();*/ break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'news` ( `news_id` int(11) NOT NULL AUTO_INCREMENT, `news_title` varchar(250) NOT NULL, `news_featured` tinyint(1) DEFAULT NULL, `news_content` text NOT NULL, `news_plain` text NOT NULL, `news_type` tinyint(2) NOT NULL, `news_lang` tinyint(2) NOT NULL, `news_publish` datetime NOT NULL, `news_created` datetime NOT NULL, `news_author` int(11) NOT NULL, `news_last_changed` datetime NOT NULL, `news_last_change` int(11) NOT NULL, PRIMARY KEY (`news_id`), KEY `news_author` (`news_author`), KEY `news_last_change` (`news_last_change`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'news` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'news_ibfk_1` FOREIGN KEY (`news_author`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'news_ibfk_2` FOREIGN KEY (`news_last_change`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'news_tag` ( `news_tag_id` int(11) NOT NULL AUTO_INCREMENT, `news_tag_news` int(11) NOT NULL, `news_tag_tag` varchar(20) NOT NULL, PRIMARY KEY (`news_tag_id`), KEY `news_tag_news` (`news_tag_news`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'news_tag` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'news_tag_ibfk_1` FOREIGN KEY (`news_tag_news`) REFERENCES `' . $dbPool->get('core')->prefix . 'news` (`news_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'news_group` ( `news_group_id` int(11) NOT NULL AUTO_INCREMENT, `news_group_news` int(11) NOT NULL, `news_group_group` int(11) NOT NULL, PRIMARY KEY (`news_group_id`), KEY `news_group_news` (`news_group_news`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'news_group` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'news_group_ibfk_1` FOREIGN KEY (`news_group_news`) REFERENCES `' . $dbPool->get('core')->prefix . 'news` (`news_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'media` ( `media_id` int(11) NOT NULL AUTO_INCREMENT, `media_name` varchar(100) NOT NULL, `media_versioned` tinyint(1) NOT NULL, `media_file` varchar(255) NOT NULL, `media_extension` varchar(10) NULL, `media_size` int(11) NULL, `media_created_by` int(11) DEFAULT NULL, `media_created_at` datetime DEFAULT NULL, PRIMARY KEY (`media_id`), KEY `media_created_by` (`media_created_by`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'media` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'media_ibfk_1` FOREIGN KEY (`media_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'media_relation` ( `media_relation_id` int(11) NOT NULL AUTO_INCREMENT, `media_relation_src` int(11) NULL, `media_relation_dst` int(11) NULL, PRIMARY KEY (`media_relation_id`), KEY `media_relation_src` (`media_relation_src`), KEY `media_relation_dst` (`media_relation_dst`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'media_relation` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'media_relation_ibfk_1` FOREIGN KEY (`media_relation_src`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'media_relation_ibfk_2` FOREIGN KEY (`media_relation_dst`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'media_permission` ( `media_permission_id` int(11) NOT NULL AUTO_INCREMENT, `media_permission_type` tinyint(1) NOT NULL, `media_permission_reference` int(11) NOT NULL, `media_permission_permission` tinyint(2) NOT NULL, `media_permission_media` int(11) NOT NULL, PRIMARY KEY (`media_permission_id`), KEY `media_permission_media` (`media_permission_media`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'media_permission` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'media_permission_ibfk_1` FOREIGN KEY (`media_permission_media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'calendar` ( `calendar_id` int(11) NOT NULL AUTO_INCREMENT, `calendar_name` varchar(25) NOT NULL, `calendar_password` varchar(64) NOT NULL, `calendar_description` varchar(255) NOT NULL, `calendar_creator` int(11) NOT NULL, `calendar_created` datetime NOT NULL, PRIMARY KEY (`calendar_id`), KEY `calendar_creator` (`calendar_creator`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_ibfk_1` FOREIGN KEY (`calendar_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'calendar_permission` ( `calendar_permission_id` int(11) NOT NULL AUTO_INCREMENT, `calendar_permission_account` int(11) NOT NULL, `calendar_permission_calendar` int(11) NOT NULL, `calendar_permission_permission` tinyint(2) NOT NULL, PRIMARY KEY (`calendar_permission_id`), KEY `calendar_permission_account` (`calendar_permission_account`), KEY `calendar_permission_calendar` (`calendar_permission_calendar`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_permission` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_permission_ibfk_1` FOREIGN KEY (`calendar_permission_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_permission_ibfk_2` FOREIGN KEY (`calendar_permission_calendar`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar` (`calendar_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'calendar_event` ( `calendar_event_id` int(11) NOT NULL AUTO_INCREMENT, `calendar_event_name` varchar(25) NOT NULL, `calendar_event_description` varchar(255) NOT NULL, `calendar_event_start` datetime NOT NULL, `calendar_event_end` datetime NOT NULL, `calendar_event_status` tinyint(1) NOT NULL, `calendar_event_repeat` tinyint(1) NOT NULL, `calendar_event_rep_interval` tinyint(3) NOT NULL, `calendar_event_rep_monday` tinyint(1) NOT NULL, `calendar_event_rep_tuesday` tinyint(1) NOT NULL, `calendar_event_rep_wednesday` tinyint(1) NOT NULL, `calendar_event_rep_thursday` tinyint(1) NOT NULL, `calendar_event_rep_friday` tinyint(1) NOT NULL, `calendar_event_rep_saturday` tinyint(1) NOT NULL, `calendar_event_rep_sunday` tinyint(1) NOT NULL, `calendar_event_creator` int(11) NOT NULL, `calendar_event_created` datetime NOT NULL, `calendar_event_calendar` int(11) NOT NULL, PRIMARY KEY (`calendar_event_id`), KEY `calendar_event_creator` (`calendar_event_creator`), KEY `calendar_event_calendar` (`calendar_event_calendar`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_event` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_1` FOREIGN KEY (`calendar_event_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_2` FOREIGN KEY (`calendar_event_calendar`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar` (`calendar_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'calendar_event_participant` ( `calendar_event_participant_id` int(11) NOT NULL AUTO_INCREMENT, `calendar_event_participant_event` int(11) NOT NULL, `calendar_event_participant_person` int(11) NOT NULL, `calendar_event_participant_status` tinyint(1) NOT NULL, PRIMARY KEY (`calendar_event_participant_id`), KEY `calendar_event_participant_event` (`calendar_event_participant_event`), KEY `calendar_event_participant_person` (`calendar_event_participant_person`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_event_participant` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_participant_ibfk_1` FOREIGN KEY (`calendar_event_participant_event`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar_event` (`calendar_event_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_participant_ibfk_2` FOREIGN KEY (`calendar_event_participant_person`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database pool instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'reporter` ( `reporter_id` int(11) NOT NULL AUTO_INCREMENT, `reporter_title` varchar(25) NOT NULL, `reporter_desc` varchar(255) NOT NULL, `reporter_media` int(11) NOT NULL, `reporter_creator` int(11) NOT NULL, `reporter_created` datetime NOT NULL, PRIMARY KEY (`reporter_id`), KEY `reporter_media` (`reporter_media`), KEY `reporter_creator` (`reporter_creator`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'reporter` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'reporter_ibfk_1` FOREIGN KEY (`reporter_media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'reporter_ibfk_2` FOREIGN KEY (`reporter_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'reporter_permission` ( `reporter_permission_id` int(11) NOT NULL AUTO_INCREMENT, `reporter_permission_type` tinyint(1) NOT NULL, `reporter_permission_reference` int(11) NOT NULL, `reporter_permission_permission` tinyint(2) NOT NULL, `reporter_permission_report` int(11) NOT NULL, PRIMARY KEY (`reporter_permission_id`), KEY `reporter_permission_report` (`reporter_permission_report`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'reporter_permission` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'reporter_permission_ibfk_1` FOREIGN KEY (`reporter_permission_report`) REFERENCES `' . $dbPool->get('core')->prefix . 'reporter` (`reporter_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'message` ( `message_id` int(11) NOT NULL AUTO_INCREMENT, `message_type` tinyint(11) NOT NULL, `message_account` int(11) DEFAULT NULL, `message_email` varchar(256) NULL, `message_sent` datetime NULL, `message_cc` varchar(256) DEFAULT NULL, `message_bcc` varchar(256) DEFAULT NULL, `message_content` text DEFAULT NULL, `message_reference` int(11) DEFAULT NULL, PRIMARY KEY (`message_id`), KEY `message_account` (`message_account`), KEY `message_reference` (`message_reference`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'message` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'message_ibfk_1` FOREIGN KEY (`message_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'message_ibfk_2` FOREIGN KEY (`message_reference`) REFERENCES `' . $dbPool->get('core')->prefix . 'message` (`message_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'messages_attachment` ( `messages_attachment_id` int(11) NOT NULL AUTO_INCREMENT, `messages_attachment_media` int(11) DEFAULT NULL, `messages_attachment_message` int(11) NULL, PRIMARY KEY (`messages_attachment_id`), KEY `messages_attachment_media` (`messages_attachment_media`), KEY `messages_attachment_message` (`messages_attachment_message`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'messages_attachment` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'messages_attachment_ibfk_1` FOREIGN KEY (`messages_attachment_media`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'messages_attachment_ibfk_2` FOREIGN KEY (`messages_attachment_message`) REFERENCES `' . $dbPool->get('core')->prefix . 'message` (`message_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'arrival` ( `arrival_id` int(11) NOT NULL AUTO_INCREMENT, `arrival_date` datetime NOT NULL, `arrival_carrier` int(11) NOT NULL, `arrival_responsible` int(11) NOT NULL, `arrival_media` int(11) NOT NULL, PRIMARY KEY (`arrival_id`), KEY `arrival_carrier` (`arrival_carrier`), KEY `arrival_responsible` (`arrival_responsible`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'arrival` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'arrival_ibfk_1` FOREIGN KEY (`arrival_carrier`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'arrival_ibfk_2` FOREIGN KEY (`arrival_responsible`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'arrival_status` ( `arrival_status_id` int(11) NOT NULL AUTO_INCREMENT, `arrival_status_amount` tinyint(1) NOT NULL, `arrival_status_condition` tinyint(1) NOT NULL, `arrival_status_arrival` int(11) NOT NULL, PRIMARY KEY (`arrival_status_id`), KEY `arrival_status_arrival` (`arrival_status_arrival`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'arrival_status` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'arrival_status_ibfk_1` FOREIGN KEY (`arrival_status_arrival`) REFERENCES `' . $dbPool->get('core')->prefix . 'arrival` (`arrival_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'cost_center_accounting` ( `cost_center_accounting_id` int(11) NOT NULL AUTO_INCREMENT, `cost_center_accounting_name` varchar(25) NOT NULL, `cost_center_accounting_description` varchar(255) NOT NULL, `cost_center_accounting_parent` int(11) NOT NULL, PRIMARY KEY (`cost_center_accounting_id`), KEY `cost_center_accounting_parent` (`cost_center_accounting_parent`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'cost_center_accounting` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'cost_center_accounting_ibfk_1` FOREIGN KEY (`cost_center_accounting_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'cost_center_accounting` (`cost_center_accounting_id`);')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'accounting_posting_ele` ADD `accounting_posting_ele_costcenter` int(11) NOT NULL, ADD KEY `accounting_posting_ele_costcenter` (`accounting_posting_ele_costcenter`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'accounting_posting_ele_ibfk_2` FOREIGN KEY (`accounting_posting_ele_costcenter`) REFERENCES `' . $dbPool->get('core')->prefix . 'cost_center_accounting` (`cost_center_accounting_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'business_unit` ( `business_unit_id` int(11) NOT NULL AUTO_INCREMENT, `business_unit_status` tinyint(2) DEFAULT NULL, `business_unit_matchcode` varchar(50) DEFAULT NULL, `business_unit_name` varchar(50) DEFAULT NULL, `business_unit_parent` int(11) DEFAULT NULL, PRIMARY KEY (`business_unit_id`), KEY `business_unit_parent` (`business_unit_parent`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'business_unit` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'business_unit_ibfk_1` FOREIGN KEY (`business_unit_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_unit` (`business_unit_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'business_department` ( `business_department_id` int(11) NOT NULL AUTO_INCREMENT, `business_department_name` varchar(30) DEFAULT NULL, `business_department_parent` int(11) DEFAULT NULL, `business_department_unit` int(11) NOT NULL, PRIMARY KEY (`business_department_id`), KEY `business_department_parent` (`business_department_parent`), KEY `business_department_unit` (`business_department_unit`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'business_department` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'business_department_ibfk_1` FOREIGN KEY (`business_department_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_department` (`business_department_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'business_department_ibfk_2` FOREIGN KEY (`business_department_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_unit` (`business_unit_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'business_address` ( `business_address_id` int(11) NOT NULL AUTO_INCREMENT, `business_address_status` tinyint(2) DEFAULT NULL, `business_address_matchcode` varchar(50) DEFAULT NULL, `business_address_name` varchar(50) DEFAULT NULL, `business_address_fao` varchar(30) DEFAULT NULL, `business_address_addr` varchar(50) DEFAULT NULL, `business_address_city` varchar(20) DEFAULT NULL, `business_address_zip` varchar(20) DEFAULT NULL, `business_address_state` varchar(20) DEFAULT NULL, `business_address_country` varchar(30) DEFAULT NULL, `business_address_unit` int(11) DEFAULT NULL, PRIMARY KEY (`business_address_id`), KEY `business_address_unit` (`business_address_unit`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'business_address` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'business_address_ibfk_1` FOREIGN KEY (`business_address_unit`) REFERENCES `' . $dbPool->get('core')->prefix . 'business_unit` (`business_unit_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'billing_invoice` ( `billing_invoice_id` int(11) NOT NULL AUTO_INCREMENT, `billing_invoice_status` tinyint(2) DEFAULT NULL, `billing_invoice_shipTo` varchar(50) DEFAULT NULL, `billing_invoice_shipFAO` varchar(30) DEFAULT NULL, `billing_invoice_shipAddr` varchar(50) DEFAULT NULL, `billing_invoice_shipCity` varchar(20) DEFAULT NULL, `billing_invoice_shipZip` varchar(20) DEFAULT NULL, `billing_invoice_shipCountry` varchar(30) DEFAULT NULL, `billing_invoice_billTo` varchar(50) DEFAULT NULL, `billing_invoice_billFAO` varchar(30) DEFAULT NULL, `billing_invoice_billAddr` varchar(50) DEFAULT NULL, `billing_invoice_billCity` varchar(20) DEFAULT NULL, `billing_invoice_billZip` varchar(20) DEFAULT NULL, `billing_invoice_billCountry` varchar(30) DEFAULT NULL, `billing_invoice_type` tinyint(2) DEFAULT NULL, `billing_invoice_created` datetime DEFAULT NULL, `billing_invoice_shippdate` datetime DEFAULT NULL, `billing_invoice_printed` datetime DEFAULT NULL, `billing_invoice_price` decimal(9,2) DEFAULT NULL, `billing_invoice_currency` varchar(3) DEFAULT NULL, `billing_invoice_freightage` decimal(9,2) DEFAULT NULL, `billing_invoice_info` text DEFAULT NULL, `billing_invoice_voucher` int(11) DEFAULT NULL, `billing_invoice_promotion` int(11) DEFAULT NULL, `billing_invoice_creator` int(11) NOT NULL, `billing_invoice_client` int(11) NOT NULL, `billing_invoice_referer` int(11) DEFAULT NULL, `billing_invoice_reference` int(11) DEFAULT NULL, PRIMARY KEY (`billing_invoice_id`), KEY `billing_invoice_creator` (`billing_invoice_creator`), KEY `billing_invoice_client` (`billing_invoice_client`), KEY `billing_invoice_referer` (`billing_invoice_referer`), KEY `billing_invoice_reference` (`billing_invoice_reference`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'billing_invoice` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'billing_invoice_ibfk_1` FOREIGN KEY (`billing_invoice_creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'billing_invoice_ibfk_2` FOREIGN KEY (`billing_invoice_client`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'billing_invoice_ibfk_3` FOREIGN KEY (`billing_invoice_referer`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`), ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'billing_invoice_ibfk_4` FOREIGN KEY (`billing_invoice_reference`) REFERENCES `' . $dbPool->get('core')->prefix . 'billing_invoice` (`billing_invoice_id`);')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'billing_invoice_element` ( `billing_invoice_element_id` int(11) NOT NULL AUTO_INCREMENT, `billing_invoice_element_position` smallint(5) NOT NULL, `billing_invoice_element_article` int(11) NOT NULL, `billing_invoice_element_name` varchar(30) NOT NULL, `billing_invoice_element_desc` text NOT NULL, `billing_invoice_element_quantity` int(11) NOT NULL, `billing_invoice_element_price` decimal(11,2) NOT NULL, `billing_invoice_element_tax` decimal(5,2) NOT NULL, `billing_invoice_element_discountp` decimal(5,2) NOT NULL, `billing_invoice_element_discount` decimal(11,2) NOT NULL, `billing_invoice_element_invoice` int(11) NOT NULL, PRIMARY KEY (`billing_invoice_element_id`), KEY `billing_invoice_element_invoice` (`billing_invoice_element_invoice`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'billing_invoice_element` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'billing_invoice_element_ibfk_1` FOREIGN KEY (`billing_invoice_element_invoice`) REFERENCES `' . $dbPool->get('core')->prefix . 'billing_invoice` (`billing_invoice_id`);')->execute(); break; } }
/** * Install module * * @param \phpOMS\DataStorage\Database\Pool $dbPool Database instance * @param array $info Module info * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public static function install($dbPool, $info) { switch ($dbPool->get('core')->getType()) { case \phpOMS\DataStorage\Database\DatabaseType::MYSQL: $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'production_process` ( `ProcessID` int(11) NOT NULL AUTO_INCREMENT, `product` int(11) NOT NULL, `status` tinyint(2) NOT NULL, `quantity` int(11) NOT NULL, `for` int(11) NULL, `orderer` int(11) NULL, `ordered` datetime DEFAULT NULL, `due` datetime DEFAULT NULL, `planned` datetime DEFAULT NULL, `started` datetime DEFAULT NULL, `done` datetime DEFAULT NULL, PRIMARY KEY (`ProcessID`), KEY `product` (`product`), KEY `for` (`for`), KEY `orderer` (`orderer`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); /*$dbPool->get('core')->con->prepare( 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'production_process` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'production_process_ibfk_1` FOREIGN KEY (`creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' )->execute();*/ $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'production_guideline` ( `ProductionGuidelineID` int(11) NOT NULL AUTO_INCREMENT, `product` int(11) NOT NULL, PRIMARY KEY (`ProductionGuidelineID`), KEY `product` (`product`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'production_guideline_step` ( `ProductionStepID` int(11) NOT NULL AUTO_INCREMENT, `guideline` int(11) NOT NULL, `title` varchar(50) NOT NULL, `text` text NOT NULL, `order` tinyint(3) NOT NULL, PRIMARY KEY (`ProductionStepID`), KEY `guideline` (`guideline`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;')->execute(); $dbPool->get('core')->con->prepare('ALTER TABLE `' . $dbPool->get('core')->prefix . 'production_guideline_step` ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'production_guideline_step_ibfk_1` FOREIGN KEY (`guideline`) REFERENCES `' . $dbPool->get('core')->prefix . 'production_guideline` (`ProductionGuidelineID`);')->execute(); break; } }