I have a question regarding database management practices. I’ve noticed that in some database management tools, it's possible to right-click on a record and delete it directly by selecting "Delete Row."
Is it considered safe to do this, or could it potentially have negative impacts on the database? Are there any risks associated with this method that I should be aware of, especially regarding data integrity, relationships between tables, or any cascading effects?
Also, are there best practices I should follow when deleting records to ensure the database remains stable and consistent?
Hello @selva manin
It's important to be cautious when deleting records directly from a database management tool by right-clicking and selecting "Delete Row." While this method may be convenient, it has several risks and considerations.
Some potential risks include compromising data integrity, losing the audit trail, and impacting transactional integrity. To mitigate these risks, it's advisable to use a delete rule to protect against data loss.
https://success.outsystems.com/documentation/11/building_apps/data_management/data_modeling/entity_relationships/delete_rules/
Regards
Nikhil Kumar Vijay
I don't think the delete entity action attached to an entity in Outsystems does much more than just deleting a record, so I think all downsides / risks are comparable.
Not agreeing here. If you implement a CRUD Delete Wrapper with authorization & business logic, then deleting the record directly from the Service Studio Data tab, or another data management tool via which you have access to the data directly, is bypassing all your business logic.
So I agree with Nikss, it should be done with care, in any other environment than Development environment.
yes, totally agree that it should be done with care and that delete wrappers with proper authorization / rules / audit trails are the way to go.
My point is that simply executing the DeleteEntity action doesn't give any of those advantages. And looking at many of the so called CRUD wrappers I see being written, even those are doing nothing more.
So the only protection that remains is referential integrity, and that is taken care of by the DBMS, not the platform, so a naked call of DeleteEntity will have roughly the same effect as doing it through for example the data tab of Service Studio.
@selva manin As I understand your question is about the impact of directly deleting the records from Service Studio after View Data in Entities. Please note that you cannot preview data in a production environment ( Reference : Feature availability for different Purposes ) and hence this 'Delete row' cannot be executed.
Since this is in development, I don't see any issues. An error will occur if there is a referential integrity problem, preventing the deletion.
However, if you are working with an on-premise database and someone is performing direct operations, you need to be cautious.
Deleteting records directly from db is very handy when prgrammer working on development environment.
It saves lot of time
When it comes to Qa or prod I personally dont recommend using this feature.
Categorycally on prod dba shoud diaable this feature for prod support teams (L2 teams)
In general on prod environment(and UAT as wel) following steps need to follow :
1 - Do RCA
2 - Use query to investigate issue.
3 - Identify records need to delete or update using select query. In outsystems one can user aggregates also
4 - Write delete or update query by using where condition used in step no 3
5 - Execute it.
This is best practice I recommend for Prod and UAT/QA. If we follow same practice in dev nothing like it. It may take some additional effort and time but it will develop correct habbit. This habbit is useful when correcting data in the PROD/UAT/QA