Description of problem: According to .test_case_components, there should be a case_id 1 In [5]: e("SELECT component_id FROM Testopia.test_case_components WHERE case_id = 1") In [6]: for a in f(): print a (23005,) (23006,) (23007,) But there isn't... In [11]: e("SELECT True FROM Testopia.test_cases WHERE case_id = 1") In [12]: for a in f(): print a # None
A many-to-many relationship between case and component. test_case_components is a intermediary table which manage many-to-many relationships. Case(case_id = 1) was delete but the test_case_component records retain.
When a case_id (eg, 1) is deleted, shouldn't test_case_component map be updated as well to remove the relationship which no longer exists? (activity history should track the fact that it did exist in the past...and that it was removed) Many-to-Many relationships should only map to existing data, no? Or is a mapping like this valid, where items are mapped that don't exist? Doesn't make sense to me. I would think for sure when case_id was removed, all current references to case_id 1 should be removed as well... since there will be no reference to case_id 1 anymore... or better yet, case_id should not have been removed, but rather set to 'disabled=True', no? If that happened, this problem of missing references wouldn't exist. Anyway, i believe either case_id 1 should be restored and set to disabled or all references to it should be removed. Otherwise, how are we supposed to interpret mappings to things that don't exist?
(In reply to comment #2) > When a case_id (eg, 1) is deleted, shouldn't test_case_component map be > updated as well to remove the relationship which no longer exists? (activity > history should track the fact that it did exist in the past...and that it > was removed) > > Many-to-Many relationships should only map to existing data, no? > > Or is a mapping like this valid, where items are mapped that don't exist? > > Doesn't make sense to me. I would think for sure when case_id was removed, > all current references to case_id 1 should be removed as well... since there > will be no reference to case_id 1 anymore... or better yet, case_id should > not have been removed, but rather set to 'disabled=True', no? If that > happened, this problem of missing references wouldn't exist. > > > Anyway, i believe either case_id 1 should be restored and set to disabled or > all references to it should be removed. > > Otherwise, how are we supposed to interpret mappings to things that don't > exist? testcase (eg, case_id 1) is the history record which migrate from testopia to TCMS. In TCMS, case was removed, all current references to case (eg, component) was removed as well. You can write a new case and add component, if testcase delete, intermediary table(eg, test_case_components) record will delete.