解决禅道升级报错:Column not found: 1054 Unknown column 'readme' in 'zt_im_client'

解决禅道升级报错:Column not found: 1054 Unknown column ‘readme’ in ‘zt_im_client’
The sql is: ALTER TABLE zt_im_client CHANGE readme changeLog text NOT NULL

版本开源11.3升级到12.2最新版
因为操作过几次升级,一切按照步骤走(操作前一定要备份,真的很重要)。
当页面执行升级sql的时候报错了。
报错信息如标题所示:

去禅道官网上搜索了一遍,有同样和类似的问题,但是没有解决方式。
去问禅道技术人员,不能及时得到解答,只能自己查原因,这里记录下。
既然问题出在升级的sql上,所以直接去升级源码包里查看sql语句:

cd /opt/zbox/app/zentao/db

grep -rl ‘redame’ ./*

./upgradexuanxuan2.4.0.sql
./upgradexuanxuan2.5.0.sql
./zentao.sql

进去查看这3个升级语句的情况。

在upgradexuanxuan2.4.0.sql和upgradexuanxuan2.5.0.sql里分别是:
vim upgradexuanxuan2.4.0.sql
ALTER TABLE zt_im_messagestatus ADD message INT(11) UNSIGNED NOT NULL AFTER user;

CREATE TABLE IF NOT EXISTS zt_im_xxcversion (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
version char(10) NOT NULL DEFAULT ‘’,
desc varchar(100) NOT NULL DEFAULT ‘’,
readme text NOT NULL,
strategy varchar(10) NOT NULL DEFAULT ‘’,
downloads text NOT NULL,
createdDate datetime NOT NULL,
createdBy varchar(30) NOT NULL DEFAULT ‘’,
editedDate datetime NOT NULL,
editedBy varchar(30) NOT NULL DEFAULT ‘’,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

vim upgradexuanxuan2.5.0.sql

UPDATE zt_config SET key = ‘https’ WHERE owner = ‘system’ AND module = ‘common’ AND section = ‘xuanxuan’ AND key = ‘isHttps’;
UPDATE zt_config SET key = ‘backendLang’ WHERE owner = ‘system’ AND module = ‘common’ AND section = ‘xuanxuan’ AND key = ‘xxbLang’;

DATE zt_grouppriv SET module = ‘client’, method = ‘browse’ WHERE module = ‘setting’ AND method = ‘xxcversion’;
UPDATE zt_grouppriv SET module = ‘client’, method = ‘create’ WHERE module = ‘setting’ AND method = ‘createxxcversion’;
UPDATE zt_grouppriv SET module = ‘client’, method = ‘edit’ WHERE module = ‘setting’ AND method = ‘editxxcversion’;
UPDATE zt_grouppriv SET module = ‘client’, method = ‘delete’ WHERE module = ‘setting’ AND method = ‘deletexxcversion’;

RENAME TABLE zt_im_xxcversion TO zt_im_client;
ALTER TABLE zt_im_client CHANGE readme changeLog text NOT NULL;
ALTER TABLE zt_im_client ADD status ENUM(‘released’,‘wait’) NOT NULL DEFAULT ‘wait’ AFTER editedBy;

问题就出在下面这段:
RENAME TABLE zt_im_xxcversion TO zt_im_client;
ALTER TABLE zt_im_client CHANGE readme changeLog text NOT NULL;
ALTER TABLE zt_im_client ADD status ENUM(‘released’,‘wait’) NOT NULL DEFAULT ‘wait’ AFTER editedBy;

数据库里有一个重命名的操作,我查了下自己禅道的数据库库表详情(这里记得恢复下禅道的数据库,前面已经升级乱了)发现里面已经存在zt_im_client这个表,而且表结构里没有readme这个字段的。
解决禅道升级报错:Column not found: 1054 Unknown column 'readme' in 'zt_im_client'_第1张图片
解决禅道升级报错:Column not found: 1054 Unknown column 'readme' in 'zt_im_client'_第2张图片
所以问题找到了,这个表是给啥宣萱功能用的,实际上没有用这个的话,里面是没有数据的。
我在upgradexuanxuan2.5.0.sql升级表里加了一句
DROP TABLE IF EXISTS zt_im_client;

vim upgradexuanxuan2.5.0.sql
DROP TABLE IF EXISTS zt_im_client;
RENAME TABLE zt_im_xxcversion TO zt_im_client;
ALTER TABLE zt_im_client CHANGE readme changeLog text NOT NULL;
ALTER TABLE zt_im_client ADD status ENUM(‘released’,‘wait’) NOT NULL DEFAULT ‘wait’ AFTER editedBy;

2
保存,然后重新操作升级页面。
OK,升级完成。

另外,还有一个问题 11.3版本在Ubuntu18上运行,禅道数据库会崩掉。这个注意下。

你可能感兴趣的:(个人日志,linux,禅道,运维,Ubuntu)