diff --git a/db/standard/zentao17.5.sql b/db/standard/zentao17.5.sql index 71e49578e5..2473991ba5 100644 --- a/db/standard/zentao17.5.sql +++ b/db/standard/zentao17.5.sql @@ -1182,11 +1182,14 @@ CREATE TABLE `zt_im_chat` ( `ownedBy` varchar(30) NOT NULL DEFAULT '', `editedBy` varchar(30) NOT NULL DEFAULT '', `editedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `mergedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `lastActiveTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `lastMessage` int(11) unsigned NOT NULL DEFAULT '0', `lastMessageIndex` int(11) unsigned NOT NULL DEFAULT 0, `dismissDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `pinnedMessages` text NOT NULL, + `mergedChats` text NOT NULL DEFAULT '', + `adminInvite` enum('0','1') NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `gid` (`gid`), KEY `name` (`name`), diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 653ffe0676..fed5db039d 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -536,8 +536,8 @@ class upgradeModel extends model if(!$executedXuanxuan) { $table = $this->config->db->prefix . 'im_chat'; - $result = $this->checkFieldsExists($table, 'adminInvite'); - if($result->rowCount() == 0) + $exists = $this->checkFieldsExists($table, 'adminInvite'); + if(!$exists) { $this->dbh->query("ALTER TABLE $table ADD `adminInvite` enum('0','1') NOT NULL DEFAULT '0' AFTER `mergedChats`"); } @@ -7081,10 +7081,12 @@ class upgradeModel extends model * @param string $table * @param string $field * @access public - * @return object + * @return bool */ public function checkFieldsExists($table, $field) { - return $this->dbh->query("show columns from `$table` like '$field'"); + $result = $this->dbh->query("show columns from `$table` like '$field'"); + + return $result->rowCount() > 0; } }