[*] MQ миграции таблиц

This commit is contained in:
rsgrinko committed 2022-07-06 22:46:29 +03:00
1 parent 2bcd7f16cb
commit 90af02f6cb
5 files changed
+14 -13

No files matched your search

+2 -1
View File
@@ -208,7 +208,8 @@
</a> </a>
<div class="media-body"> <div class="media-body">
<h4 class="media-heading"><?=$arUser['name']; ?></h4> <h4 class="media-heading"><?=$arUser['name']; ?></h4>
<small class="text-muted"><?=$arUser['access_level']; ?></small> <small class="text-muted"><?=$arUser['email'];?>
</small>
</div> </div>
</div><!-- media --> </div><!-- media -->
+1 -1
View File
@@ -45,7 +45,7 @@
<td><?=$MQ->getCountTasks();?></td> <td><?=$MQ->getCountTasks();?></td>
<td><?=$MQ->getCountTasks(['active' => 'Y', 'in_progress' => 'N']);?></td> <td><?=$MQ->getCountTasks(['active' => 'Y', 'in_progress' => 'N']);?></td>
<td><?=$MQ->getCountTasks(['active' => 'Y', 'in_progress' => 'Y']);?></td> <td><?=$MQ->getCountTasks(['active' => 'Y', 'in_progress' => 'Y']);?></td>
<td><?=$MQ->getCountTasks(['active' => 'N', 'in_progress' => 'N', 'status' => MQ::STATUS_ERROR]);?></td> <td><?=$MQ->getCountTasks(['in_progress' => 'N', 'status' => MQ::STATUS_ERROR]);?></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
+3 -4
View File
@@ -2,9 +2,10 @@ CREATE TABLE `threads` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`active` varchar(1) NOT NULL DEFAULT 'N', `active` varchar(1) NOT NULL DEFAULT 'N',
`in_progress` varchar(1) NOT NULL DEFAULT 'N', `in_progress` varchar(1) NOT NULL DEFAULT 'N',
`executed` varchar(1) NOT NULL DEFAULT 'N', `priority` int(11) DEFAULT NULL,
`execution_time` varchar(255) DEFAULT NULL, `execution_time` varchar(255) DEFAULT NULL,
`attempts` int(11) NOT NULL, `attempts` int(11) NOT NULL,
`attempts_limit` int(11) DEFAULT '1',
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` datetime DEFAULT NULL, `date_updated` datetime DEFAULT NULL,
`class` varchar(255) DEFAULT NULL, `class` varchar(255) DEFAULT NULL,
@@ -13,8 +14,6 @@ CREATE TABLE `threads` (
`status` varchar(255) DEFAULT NULL, `status` varchar(255) DEFAULT NULL,
`response` text `response` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `threads` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`); ALTER TABLE `threads` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78989;
ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17923;
COMMIT; COMMIT;
+4 -4
View File
@@ -398,7 +398,7 @@
'active' => self::VALUE_N, 'active' => self::VALUE_N,
'in_progress' => self::VALUE_N, 'in_progress' => self::VALUE_N,
'attempts' => '0', 'attempts' => '0',
'attempts_limit' => $this->attempts, 'attempts_limit' => $this->runNow ? '1' : $this->attempts, // Если запускаем немедленно, то попытка одна
'class' => !empty($class) ? addslashes($class) : '', 'class' => !empty($class) ? addslashes($class) : '',
'method' => $method, 'method' => $method,
'priority' => $priority, 'priority' => $priority,
@@ -504,11 +504,11 @@
} }
if (!empty($arTask['class']) && !method_exists($arTask['class'], $arTask['method'])) { if (!empty($arTask['class']) && !method_exists($arTask['class'], $arTask['method'])) {
throw new CoreException('Класс или метод не определен, невозможно выполнить', CoreException::ERROR_CLASS_OR_METHOD_NOT_FOUND); throw new CoreException('Класс или метод не существует, невозможно выполнить', CoreException::ERROR_CLASS_OR_METHOD_NOT_FOUND);
} }
if (empty($arTask['class']) && !empty($arTask['method']) && !function_exists($arTask['method'])) { if (empty($arTask['class']) && !empty($arTask['method']) && !function_exists($arTask['method'])) {
throw new CoreException('Функция не определена, невозможно выполнить', CoreException::ERROR_CLASS_OR_METHOD_NOT_FOUND); throw new CoreException('Функция не существует, невозможно выполнить', CoreException::ERROR_CLASS_OR_METHOD_NOT_FOUND);
} }
if (empty($arTask['class'])) { if (empty($arTask['class'])) {
@@ -572,7 +572,7 @@
); );
// TODO: Следующая строка нужна больше для отладки - в дальнейшем нужно удалить ее // TODO: Следующая строка нужна больше для отладки - в дальнейшем нужно удалить ее
echo 'Exception: ' . $t->getFile() . ' в строке ' . $t->getLine() . PHP_EOL . $t->getMessage() . PHP_EOL; //echo 'Exception: ' . $t->getFile() . ' в строке ' . $t->getLine() . PHP_EOL . $t->getMessage() . PHP_EOL;
} }
return $response; return $response;
+4 -3
View File
@@ -1,10 +1,11 @@
CREATE TABLE if not exists `threads` ( CREATE TABLE `threads` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`active` varchar(1) NOT NULL DEFAULT 'N', `active` varchar(1) NOT NULL DEFAULT 'N',
`in_progress` varchar(1) NOT NULL DEFAULT 'N', `in_progress` varchar(1) NOT NULL DEFAULT 'N',
`executed` varchar(1) NOT NULL DEFAULT 'N', `priority` int(11) DEFAULT NULL,
`execution_time` varchar(255) DEFAULT NULL, `execution_time` varchar(255) DEFAULT NULL,
`attempts` int(11) NOT NULL, `attempts` int(11) NOT NULL,
`attempts_limit` int(11) DEFAULT '1',
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date_updated` datetime DEFAULT NULL, `date_updated` datetime DEFAULT NULL,
`class` varchar(255) DEFAULT NULL, `class` varchar(255) DEFAULT NULL,
@@ -14,4 +15,4 @@ CREATE TABLE if not exists `threads` (
`response` text `response` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `threads` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`); ALTER TABLE `threads` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `id` (`id`);
ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17923; ALTER TABLE `threads` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78989;