臨下班前,測試測出所有的返回報文中有一個版本號的值沒有上送,最后定位是由於數據庫配置表里版本號是空。
這應該屬於前輩們留下的bug了....
首先試了下
ALTER TABLE newftp alter column command_version varchar(10) not NULL default 'v1.0'
報錯了:[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(10) not NULL default 'v1.0'' at line 1;
之后又從網上搜了:
ALTER TABLE newftp add DEFAULT ('v1.0') for command_version WITH VALUES,然而也是執行失敗:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT ('v1.0') for command_version WITH VALUES' at line 1
后來用navcat工具修改字段默認值,然后點SQL預覽,
拿出一條新SQL:
ALTER TABLE `newftp` MODIFY COLUMN `command_version` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT "v1.0" COMMENT '版本號'
后來我把之前的alter換成了modify
ALTER TABLE newftp MODIFY column command_version varchar(10) not NULL default 'v1.0'
執行成功了...