When deleting a project, currently, deletion of events is performed for every components in the project (same for views). As a consequence, multiple SQL requests are sent to delete data from permission tables(one for every 1000 components in the project).
The fact is that events can only be defined for a given analysis and an analysis only relates to a project (or view). The number of SQL request could be therefor reduced to just one, a very much simpler one.
To avoid having data left over in the database with this new method which would have been deleted by the old one, database migrations should be added:
- make column EVENTS.COMPONENT_UUID not nullable and populate it with the UUID of the project of the analysis
- fix any incorrect value in EVENTS.COMPONENT_UUID (to the UUID of the project of the event's analysis)