execute(' CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ets_rv_staff_activity` ( `id_employee` int(11) UNSIGNED NOT NULL, `id_ets_rv_activity` int(11) UNSIGNED NOT NULL DEFAULT 0, `read` tinyint(1) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`id_employee`, `id_ets_rv_activity`) ) ENGINE=' . _MYSQL_ENGINE_ . ' CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci '); $execCmd = Db::getInstance()->execute(' INSERT IGNORE INTO `' . _DB_PREFIX_ . 'ets_rv_staff_activity` (`id_employee`, `id_ets_rv_activity`, `read`) SELECT e.`id_employee`, a.`id_ets_rv_activity`, a.`read` FROM `' . _DB_PREFIX_ . 'ets_rv_activity` a CROSS JOIN `' . _DB_PREFIX_ . 'employee` e INNER JOIN `' . _DB_PREFIX_ . 'ets_rv_staff` rs ON (rs.`id_employee` = e.`id_employee`) WHERE a.`read` = 1 AND (rs.`enabled` = 1 OR e.id_profile=1) '); if ($execCmd) Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'ets_rv_activity` DROP `read`;'); return true; }