cascadeOnDelete() on foreignIdFor()

I saw the demo site under the orders with a PaymentsRelationManager. Diving deeper with the code, it uses the foreignIdFor() in the migrations table. I tried to mirror it and used it in my project. But I want to add cascadeOnDelete() so that if the data is deleted, it also deleted the created data on the foreign column. My primary column on the reference table is a custom ID with a *(data type:char)*. Since this is my case, I cant use the default constrained(), hence, I cant also utilize the cascadeOnDelete() . Any database expert here? I want to refactor my code.
1 Reply
Dennis Koch
Dennis Koch14mo ago
You can still set a foreign key though.

Did you find this page helpful?