think icon indicating copy to clipboard operation
think copied to clipboard

6.0.5升级到6.0.7后遇到一个时间格式问题.

Open Y-A-K-E opened this issue 4 years ago • 2 comments

我数据库字段时间是int 10位长度的.

原来从6.0.1更新到6.0.5一直使用正常.

这次composer更新到6.0.7,就抛出一个异常.

模型

    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;

异常信息

think\db\exception\PDOException thrown with message "SQLSTATE[01000]: Warning: 1265 Data truncated for column 'createtime' at row 1"

可能是日期格式没有自动转换??

QQ截图20210223111456

Y-A-K-E avatar Feb 23 '21 03:02 Y-A-K-E

这个问题好像是think-orm包引起的.

think-orm回退到2.0.34版本 正常了.

引起原因好像是更新也会写入createTime .而且没有自动转换时间格式.

Y-A-K-E avatar Feb 23 '21 05:02 Y-A-K-E

看云上也有好几个人反馈过这个问题了.

https://www.kancloud.cn/manual/thinkphp6_0/1037592

Y-A-K-E avatar Feb 23 '21 05:02 Y-A-K-E