From ad8bae5acadcda0291c3a6ca579303dbd4053f04 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 31 Oct 2023 02:01:50 +0100 Subject: Rework SQL field length (#5788) * SQL auto-update field length Follow-up of https://github.com/FreshRSS/FreshRSS/pull/5756 Only for PostgreSQL and MySQL / MariaDB. Not possible for SQLite * Account for MySQL 65535 Partial revert of https://github.com/FreshRSS/FreshRSS/pull/5756 > The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead. --- app/Models/DatabaseDAO.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'app/Models/DatabaseDAO.php') diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index 45fc1967c..1f31f161a 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -214,22 +214,14 @@ SQL; return $ok; } - private function ensureYear2038Compatible(): bool { - if ($this->pdo->dbType() !== 'sqlite') { - include_once(APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'); - if ($this->pdo->exec($GLOBALS['SQL_UPDATE_YEAR_2038']) === false) { //FreshRSS 1.23 - Minz_Log::error('SQL error ' . __METHOD__ . json_encode($this->pdo->errorInfo())); - return false; - } - } - return true; - } - public function minorDbMaintenance(): void { $catDAO = FreshRSS_Factory::createCategoryDao(); $catDAO->resetDefaultCategoryName(); - $this->ensureYear2038Compatible(); + include_once(APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'); + if (!empty($GLOBALS['SQL_UPDATE_MINOR']) && $this->pdo->exec($GLOBALS['SQL_UPDATE_MINOR']) === false) { + Minz_Log::error('SQL error ' . __METHOD__ . json_encode($this->pdo->errorInfo())); + } } private static function stdError(string $error): bool { -- cgit v1.2.3