FIX: check missing table

This commit is contained in:
Juan Pablo Vial
2025-09-11 17:50:58 -03:00
parent 27c19ee087
commit 1945c5728a

View File

@ -5,6 +5,7 @@ use Incoviba\Common\Define\Connection;
use Monolog\Handler\AbstractProcessingHandler; use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Level; use Monolog\Level;
use Monolog\LogRecord; use Monolog\LogRecord;
use PDOException;
use PDOStatement; use PDOStatement;
class MySQL extends AbstractProcessingHandler class MySQL extends AbstractProcessingHandler
@ -69,13 +70,21 @@ QUERY;
private function checkTableExists(): bool private function checkTableExists(): bool
{ {
$query = "SHOW TABLES LIKE 'monolog'"; $query = "SHOW TABLES LIKE 'monolog'";
$result = $this->connection->query($query); try {
$result = $this->connection->query($query);
} catch (PDOException) {
return false;
}
return $result->rowCount() > 0; return $result->rowCount() > 0;
} }
private function checkTableDeprecatedExists(): bool private function checkTableDeprecatedExists(): bool
{ {
$query = "SHOW TABLES LIKE 'monolog_deprecated'"; $query = "SHOW TABLES LIKE 'monolog_deprecated'";
$result = $this->connection->query($query); try {
$result = $this->connection->query($query);
} catch (PDOException) {
return false;
}
return $result->rowCount() > 0; return $result->rowCount() > 0;
} }
private function createTable(): void private function createTable(): void