升级报错

回贴
回帖数 3
阅读数 1475
发表时间 2023-12-01 15:47:57
🎊
调皮的蜡烛 楼主

12.0->18.9,总是报sql语法错误



SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'updatedDate'<p>The sql is: 
CREATE TABLE IF NOT EXISTS `zt_solution` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` char(50),
`appID` mediumint(8) unsigned NOT NULL,
`appName` char(50) NOT NULL,
`appVersion` char(20) NOT NULL,
`version` char(50) NOT NULL,
`chart` char(50) NOT NULL,
`cover` varchar(255),
`desc` text,
`introduction` varchar(500),
`source` char(20) NOT NULL,
`channel` char(20),
`components` text,
`status` char(20) NOT NULL,
`deleted` tinyint(1) NOT NULL DEFAULT 0,
`createdBy` char(30) NOT NULL,
`createdAt` datetime NOT NULL,
`updatedDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8</p>
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'createdDate'<p>The sql is: 
CREATE TABLE `zt_artifactrepo` (
`id` smallint(8) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(45) CHARACTER SET utf8 NOT NULL,
`products` varchar(1000) CHARACTER SET utf8 NOT NULL,
`serverID` smallint(8) NOT NULL,
`repoName` varchar(45) CHARACTER SET utf8 NOT NULL,
`format` varchar(10) CHARACTER SET utf8 NOT NULL,
`type` char(7) CHARACTER SET utf8 NOT NULL,
`status` varchar(10) CHARACTER SET utf8 NOT NULL,
`createdBy` varchar(30) CHARACTER SET utf8 NOT NULL,
`createdDate` datetime DEFAULT CURRENT_TIMESTAMP,
`editedBy` varchar(30) CHARACTER SET utf8 NOT NULL,
`editedDate` datetime DEFAULT CURRENT_TIMESTAMP,
`deleted` tinyint(4) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4</p>


3个回复
🤖
金凯 沙发
您好,可以关闭下数据库的sql_mode试一下,另外使用current_timestamp作为datetime的默认值,只有在5.6之后的版本才支持,注意您的mysql版本。
2023-12-01 15:55:50 金凯 回帖
🎊
调皮的蜡烛 板凳
看帖子说12->18跨度太大  需要跨几个版本
目前是 12->15 报错

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pmdb_new0113_bak.zt_workflowfield' doesn't exist' in /mnt/storage_vdb/web/zentaopms_bak_for_update/lib/filter/filter.class.php:44 Stack trace: #0 /mnt/storage_vdb/web/zentaopms_bak_for_update/lib/filter/filter.class.php(44): PDO->query('SELECT * FROM `...') #1 /mnt/storage_vdb/web/zentaopms_bak_for_update/module/upgrade/control.php(163): fixer->get('mode') #2 [internal function]: upgrade->to15Guide('12_0') #3 /mnt/storage_vdb/web/zentaopms_bak_for_update/framework/base/router.class.php(1782): call_user_func_array(Array, Array) #4 /mnt/storage_vdb/web/zentaopms_bak_for_update/www/upgrade.php(64): baseRouter->loadModule() #5 {main} thrown in  /mnt/storage_vdb/web/zentaopms_bak_for_update/lib/filter/filter.class.php on line  44

09:15:54 Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pmdb_new0113_bak.zt_workflowfield' doesn't exist' in lib/filter/filter.class.php:44
Stack trace:
#0 lib/filter/filter.class.php(44): PDO->query('SELECT * FROM `...')
#1 module/upgrade/control.php(163): fixer->get('mode')
#2 [internal function]: upgrade->to15Guide('12_0')
#3 framework/base/router.class.php(1782): call_user_func_array(Array, Array)
#4 www/upgrade.php(64): baseRouter->loadModule()
#5 {main}
thrown in lib/filter/filter.class.php on line 44 when visiting /upgrade.php?m=upgrade&f=to15Guide&fromVersion=12_0

2023-12-04 09:31:30 调皮的蜡烛 回帖
🤖
金凯 #3
您好,zt_workflowfield是工作流的表,开源版15版本是没有这个表的,确认下覆盖的升级代码正确,然后恢复下数据库备份重新升级。恢复数据库备份注意先将原来的库删掉重新创建一个再恢复备份。
2023-12-04 10:22:28 金凯 回帖
联系人
丁芝/高级客户经理
电话(微信)
17663906485
QQ号码
1481227768
联系邮箱
dingzhi@chandao.com
返回顶部
丁芝
高级客户经理
17663906485
1481227768
统一服务热线 4006-8899-23
我要提问提问有任何问题,您都可以在这里提问。 问题反馈反馈点击这里,让我们聆听您的建议与反馈。