Set 'Ignore' as default delete rule.
697
Views
2
Comments
New
Database

In OutSystems when we reference any other entity's attribute then it automatically sets the Delete rule as 'protect' by default. Instead of the 'Protect'  Rule, It should be 'Ignore'. 

Why? because.

1. It is always best practice to set the delete rule as 'Ignore' because it will not create any problem if we want to delete some data in a particular table. it doesn't even matter whether the Id is referenced in another table or not.

2. If the default delete rule is Protect, then it is quite hard to run some Delete queries. Our query ain't deleting records because of the default protect rule. and managing this relationship is quite hard.

3. In OutSystems documentation it is clearly mentioned that we should use Ignore rule instead of the 'Protect' rule, then why are you promoting protect by making it default?

4. Let's say Table A and Table B has the Delete rule as 'Delete' and Table B and Table C have the 'Protect' rule. In this case, if I want to delete any record from Table A then it will always create a problem because of the reference in table C and I am not aware of this thing. But in the case of Ignore rule, we could have handled it manually, without any problems.

Thanks,

Ramesh Godara

Outsystems Certified Expert Developer

I don't agree with a lot of this idea.

There is a purpose for protect, delete and ignore rules. If at all there should be no default. For now I would prefer to have the strictest rule as default, and during data modeling decide where ignore and delete is more appropriate.

Agree with Daniel.

@Ramesh Godara , you say having protect rules creates problems, to the contrary, I think it prevents problems, because they help avoid all kinds of referential inconsistencies by pointing them out at the moment your software would cause things like orphaned orders where the product or the customer no longer exists.

Dorine