Skip to main content
Topic: disable cascade delete (Read 1404 times) previous topic - next topic

disable cascade delete

Hello everyone, I have a question that I cannot solve and that is to avoid cascade deletion. I have 2 tables related by their id which are the customer table and the invoices table. I would like to delete 1 customer not delete the invoices. Does anyone know how it can be disabled?

Greetings and thank you.

Re: disable cascade delete

Reply #1
Hi
I Think you can add foreign key to children table or at new version of PHPrad which have soft deleted that maybe avoid deleting database
Hope is help
Thinh

 

Re: disable cascade delete

Reply #2

Thanks for your answer. I think I remember reading something you are talking about, but I really don't know how it works. See if someone who has had the opportunity to use this option answers and can explain a bit how to do it. Thank you

Re: disable cascade delete

Reply #3
Hi there

As I mention have two way to avoiding  of deleting invoice if you delete customer first
1. PHPrad have no SQL constraint when create DB, you can go to mysql and using add Foreign key to the Child Table.
 in this way when you delete customer have invoice relationship --> error showing up.

2. you can add colum to customer like 'is_deleted' to remove customer showing but not real delete, phprad new version support that.

I also tried to find and remove cascase delete but not work

Thinh