Foreign Key Platform Default Delete Rule per environment


An entity foreign key attribute has a Delete Rule property which can be set to Protect, Delete or Ignore by a developer in ServiceStudio. A Performance Best Practice is to set this to Ignore, but that could lead to database inconsistencies. Therefore, during development, it is safer to use Protect. This means developers need to remember to set this rule to Protect during development and then to Ignore after testing has been completed and before deploying to production if they want to conform to this Performance Best Practice.

You can imagine this process is prone to errors. So how cool would it be if you could set a Platform Default Delete Rule per environment in LifeTime or ServiceCenter and then be able to select 'Platform Default' as the Delete Rule in ServiceStudio?

So, for example, in DEV & QA the Platform Default Delete Rule could be set to Protect and in PRD it could be set to Ignore using LifeTime or ServiceCenter. Then, when a developer chooses 'Platform Default' as the Delete Rule on a foreign key in ServiceStudio, the platform makes sure that the Delete Rule is set to Protect on the database when Publishing/Deploying to DEV and QA and that the Delete Rule is set to Ignore on the database when Deploying to PRD. So the platform automatically sets the Delete Rule on the different environments according to Performance Best Practices!

Created on 6 Dec 2018
Comments (2)

Great idea, as long as people don't do what I've seen in a number of "commercial" applications and just rely on an exception being raised to tell if it isn’t safe to delete data. 

Changed the category to Database