laravel-5 - 如何在 updated_at` 字段中设置 null?
问题描述
我在 laravel 5.7 应用程序中看到了一些行
字段定义为:
updated_at
TIMESTAMP NULL DEFAULT NULL,
具有价值 0000-00-00 00:00:00
我尝试运行下一条语句:
DB::table('clients')
->where('updated_at','0000-00-00 00:00:00')
->update([
"updated_at" => null
]);
但出现错误:
: Invalid datetime format: 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'updated_at' at row 1 (SQL: update `clients` set `updated_at` = whe
re `updated_at` = 0000-00-00 00:00:00)
哪个是对的 ?
谢谢!
解决方案
推荐阅读
- laravel - 我的查询代码有什么问题?
- c# - httpContext.Request.GetRawBodyStringAsync() 是否与 [FromBody] 字符串主体相同?
- ios - CollectionView 里面的 CollectionView | CollectionViewCell 自动布局错误
- algorithm - 现有的低分辨率目标跟踪算法
- python - Keras,Tensorflow:评估时如何在自定义层中设置断点(调试)?
- android - 如何读取来自特定电话号码的传入消息的内容
- c++ - 让用户在字符串中间输入(c/c++)?
- ios - 如何在 CMTimeMake 的时间刻度 Int32 中传递浮点数
- entity-framework - 使用 Npgsql 兑现代码优先模型
- git - 不相关的项目在 Git/GitHub 的同一个仓库中?