升级报错

2023-12-01 15:47:57
调皮的蜡烛
  • 访问次数: 7
  • 注册日期: 2023-12-01
  • 最后登录: 2024-02-22
  • 我的积分: 88
  • 门派等级: 无门派

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>


沙发
2023-12-01 15:55:50
金凯
  • 访问次数: 695
  • 注册日期: 2021-11-11
  • 最后登录: 2024-04-12
  • 我的积分: 2989
  • 门派等级: 无门派
您好,可以关闭下数据库的sql_mode试一下,另外使用current_timestamp作为datetime的默认值,只有在5.6之后的版本才支持,注意您的mysql版本。
板凳
2023-12-04 09:31:30
调皮的蜡烛
  • 访问次数: 7
  • 注册日期: 2023-12-01
  • 最后登录: 2024-02-22
  • 我的积分: 88
  • 门派等级: 无门派
看帖子说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

#3
2023-12-04 10:22:28
金凯
  • 访问次数: 695
  • 注册日期: 2021-11-11
  • 最后登录: 2024-04-12
  • 我的积分: 2989
  • 门派等级: 无门派
您好,zt_workflowfield是工作流的表,开源版15版本是没有这个表的,确认下覆盖的升级代码正确,然后恢复下数据库备份重新升级。恢复数据库备份注意先将原来的库删掉重新创建一个再恢复备份。
1/1 1