I started an ETL application with CUBA without paying attention to the Soft Deletion behavior. My bad. The DB now reaches a huge number of records and I’m not comfortable with that.
So I have 2 very simple questions.
I’m considering to use a SQL query such as : DELETE from TABLE WHERE delete_ts IS NOT NULL: is it safe? Do I have to foresee some troubles (I made tests, it looks OK but I’d like to be 200% sure)
Is there an easy way to get rid of this Soft Delete and get toward a behavior which looks more intuitive to me (i.e. when I delete, it is deleted, full stop)
Custom cascade delete at database level: cuba delete policy is implemented at middleware level, so if you created your entities using Cuba Studio and have not customized your scripts, it should be safe
Orphan records: As you are deleting at database level, it is possible that other records (which are not soft deleted) will still keep the old relationship, and you’ll have exceptions when trying to delete these records.
Either way, backup your data before the cleanup .
Your entities probably extend StandardEntity, which implements SoftDelete. If you do not want to use SoftDelete you should use another superclass. Take a look at Base Entity Classes for more information.