updated_at 列在插入期间更改
updated_at column changed during insertion
我已经使用 "save(null, {method: 'insert'})" 将新记录添加到 table。我不想在插入期间设置 "updated_at" 。我希望 update_at 在我进行更新之前保持空白。
怎么了?
Product.forge({
kind : 'data',
comment : 'comment',
})
.save(null, {method: 'insert'})
=======================
bookshelf.Model.extend({
tableName : 'products',
hasTimestamps : true})
没什么不对。这是预期和设计的行为。
...if the model isNew or if {method: 'insert'} is provided as an option and set the created_at and updated_at attributes to the current date if it is being inserted, and just the updated_at attribute if it's being updated.
因此 updated_at
列总是 更新更新和插入。
我已经使用 "save(null, {method: 'insert'})" 将新记录添加到 table。我不想在插入期间设置 "updated_at" 。我希望 update_at 在我进行更新之前保持空白。
怎么了?
Product.forge({
kind : 'data',
comment : 'comment',
})
.save(null, {method: 'insert'})
=======================
bookshelf.Model.extend({
tableName : 'products',
hasTimestamps : true})
没什么不对。这是预期和设计的行为。
...if the model isNew or if {method: 'insert'} is provided as an option and set the created_at and updated_at attributes to the current date if it is being inserted, and just the updated_at attribute if it's being updated.
因此 updated_at
列总是 更新更新和插入。