Export / delete
revoker opened this issue · comments
Description of the Issue
When making an deletion procedure from Model Extraction Screen similar to what's detailed in here; there seem to be systematically more rows inserted (in the insert script) than deleted (in the delete script).
Steps to Reproduce the Issue
- Get a database similar to http://jailer.sourceforge.net/deleting-data.htm
- In the Extraction Model Editor Select a parent entity and its children (disable / restrict the parent associations)
- Be sure that the checkbox "exclude from deletion" is on "No" or "No by default" for all the table in question.
- Click on export into let's say insert.sql and delete.sql scripts
Assert that Insert.sql has more inserts than in the delete script; ie
Expected Behavior
If 8 rows are exported in the insert.sql, then jailer should be able to generate a delete.sql with the same number of delete, so that we can always remove what we exported. If we come back to the example web page; on my machine I miss a few "Delete from PROJECT_PARTICIPATION" inside the delete.sql script.
Debug Information
Working on Ubuntu 18.04 with latest jailer 10.2.4 (zip version). NB: the problem was already present in the 9.5.2 version
Hi,
that's not an issue. The delete file contains delete statements for the largest subset of the exported rows, so that the set of remaining rows is still referentially intact.
For example, you cannot delete a parent without the associated children. So if the children are not exported (and therefore not deleted), the parent will not be deleted.
In the "Delete Reduction" tab of the progress window you can see why certain rows are not deleted. In the example below, 3 EMPLOYEES are not deleted because their subordinates were not exported/deleted. And 2 PROJECTS because their PROJECT_PARTICIPIATIONS have not been exported.