Open noobMaster2048 opened 1 month ago
21.2.0
When updating a parent model with its children, the updateOrCreateMany method executes an insert table instruction instead of an update.
`export default class Product extends BaseModel {
@hasMany(() => ProductPrice) declare prices: HasMany<typeof ProductPrice>
}`
`export default class ProductPrice extends BaseModel {
@column() declare productKey: string | undefined @belongsTo(() => Product) declare product: BelongsTo<typeof Product>
`const record = await Product.findOrFail(params.key) await record.merge(payload).save() await record.related('prices').updateOrCreateMany(payload.prices, 'price')
`
No response
Hi.
updateOrCreateMany
Package version
21.2.0
Describe the bug
When updating a parent model with its children, the updateOrCreateMany method executes an insert table instruction instead of an update.
`export default class Product extends BaseModel {
}`
`export default class ProductPrice extends BaseModel {
}`
`const record = await Product.findOrFail(params.key) await record.merge(payload).save() await record.related('prices').updateOrCreateMany(payload.prices, 'price')
`
Reproduction repo
No response