P粉7029469212023-08-31 11:27:59
Let’s break things into three parts:
If you added a foreign key constraint on another table and need to delete the brand, you should also delete all related data constrained by the foreign key.
If the brand related data cannot be removed, then maybe we can consider if there is a better design. Maybe we can add a hook on the frontend that calls the DELETE API whenever the user deletes some data.
If the brand has some unique keys, you can use upsert
instead of saveMany. This will be more efficient.
I recommend deleting the brand via a hook on the frontend whenever the user deletes it, and using upsert
to handle creating and updating
content