We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
Hi.
updateOrCreateMany
Sorry, something went wrong.
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: