update PivotModel update throws Error because doesn't have function _setUpdatedAt
See original GitHub issueHi guys! I have same problem as described in #203 I use update pivot model as documented
await object
.pictures()
.pivotQuery()
.where('picture_id', id)
.update({ sort_order: index })
And this throws error “fakeModel._setUpdatedAt is not a function”
I’ve investigated code, and
-
Crushed when calling update in https://github.com/adonisjs/adonis-lucid/blob/b613b648cf5cb6b582be716d3b775a9778fb0d2a/src/Lucid/QueryBuilder/index.js#L521
-
pivotQuery creates PivotModel instance https://github.com/adonisjs/adonis-lucid/blob/7ed413824d858274290f57f3780e12b9bd819853/src/Lucid/Relations/BelongsToMany.js#L716-L727
-
PivotModel class extends of BaseModel https://github.com/adonisjs/adonis-lucid/blob/b613b648cf5cb6b582be716d3b775a9778fb0d2a/src/Lucid/Model/PivotModel.js#L29
-
BaseModel doesn’t have function _setUpdatedAt, this function exists only Model
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Updating PivotTable requires updatedAtColumn #203 - GitHub
I don't use timestamps on both models, neither on pivot. When I try to update using model.relation().queryPivot().where().update() it throws an error saying:.
Read more >Pivot Table Will Not Update Properly - Microsoft Community Hub
I have noticed that my pivot tables do not refresh with the most recent data once I: refresh the table, refresh the powerpivot,...
Read more >Laravel Unknown Column 'updated_at' - Stack Overflow
In the model, write the below code; public $timestamps = false;. This would work. Explanation : By default laravel will expect created_at ...
Read more >How to update PowerPivots when the underlying source data ...
Demonstration of how to update data in power pivots. Outlines when to update data or refresh data. Powerpivot is an addin for excel...
Read more >How to Troubleshoot and Fix Excel Pivot Table Errors
A simple data change can cause a strange pivot table refresh error, if you added the pivot table data to the Data Model....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @rminossi!
In the meanwhile, you can directly use the
Database
class to update your fields.This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.