Open brunochimenes opened 2 years ago
are you not "cascading" the deletion on your backend to the product table by setting deleted_at on all products associated with that brand?
No, here we are not cascading the records associated with the brand. Do you have any idea how to cascade in watermelondb, where I can, after syncing, check if the brand has been deleted and after that, removes the connection between brand on product, setting the brand id as null ?
@brunochimenes You can do this: https://nozbe.github.io/WatermelonDB/Writers.html?highlight=delete#delete-action
@brunochimenes You can do this: https://nozbe.github.io/WatermelonDB/Writers.html?highlight=delete#delete-action
new link for future wanderers: https://watermelondb.dev/docs/Writers#delete-action
I have a product and brand table and on my mobile app, I'm using watermelondb with mysql. On my API, I'm using paranoid, so, I ain't deleting my records from database, but adding a value to deleted_at. So, when I delete a brand on my site , I send an API call and set the deleted_at to that specific brand. But on mobile, the brand record is deleted, but the brand_id still has the value that references the brand that got deleted. How can I handle an
observe( )
on my app, since it breaks the application when it tries do find the brand_id that doesn't exists anymore?I'm using this version: