Closed ad-momo closed 7 months ago
@adonisjs/lucid 20.3.1
Hello,
When you call updateOrCreate of LucidModel, the default values are not set.
LucidModel
For model named MyModel:
MyModel
// in MyModel model migration file table.integer('my_field').defaultTo(0);
const myModel = await MyModel.updateOrCreate(searchPayload, {}) console.log(myModel.myField) // undefined 👈
Maybe replace this part at here:
await row.save() return row
to this:
return row.save()
No response
Ok, I found the refresh ~reload~ method is required : https://github.com/adonisjs/lucid/issues/439
refresh
Package version
@adonisjs/lucid 20.3.1
Describe the bug
Hello,
When you call updateOrCreate of
LucidModel
, the default values are not set.Reproduction
For model named
MyModel
:Resolution
Maybe replace this part at here:
to this:
Reproduction repo
No response