This PR links the DataImport objects with the actual Measurement entries they generate and, to some extent, to the associated Report objects obtained after validation. This way, when a DataImport object is deleted or re-processed, the related data can be easily found and removed (automatically, as they have a CASCADE relation).
I've kept the deletion step based on time range, as some data - specially initial data or that migrated from the current system - will not have an associated DataImport object. Also, the deletion of the Report objects is not accurate as reports might combine data from multiple DataImports, and not being deleted if the wrong DataImport, based on the mode of the data used for the calculation, is associated with that entry. So, again, the deletion based on the time range comes handy.
This PR links the
DataImport
objects with the actualMeasurement
entries they generate and, to some extent, to the associatedReport
objects obtained after validation. This way, when aDataImport
object is deleted or re-processed, the related data can be easily found and removed (automatically, as they have a CASCADE relation).I've kept the deletion step based on time range, as some data - specially initial data or that migrated from the current system - will not have an associated
DataImport
object. Also, the deletion of theReport
objects is not accurate as reports might combine data from multipleDataImport
s, and not being deleted if the wrongDataImport
, based on the mode of the data used for the calculation, is associated with that entry. So, again, the deletion based on the time range comes handy.Close #338