MerginMaps / mobile

Mobile app for Mergin Maps 📲. Open QGIS projects and manage vector data on your phone, even offline 📶 (Android/iOS/Windows app)
https://merginmaps.com
GNU General Public License v2.0
280 stars 62 forks source link

Relationship strength "composite" has no effect in Input #2315

Open Ojaybee opened 1 year ago

Ojaybee commented 1 year ago

Setting a 1-n relationship in QGIS is saved in the .qgz project file. There is an option to set the strength of the relationship as shown in the Mergin docs. Using the Association setting allows deletion of the parent while child data persists. Changing this to Composition allows for cascading deletes in QGIS (if a parent is deleted child items are also deleted). QGIS will pop up a warning as to which child items from which table will be deleted.

This behaviour is not the same in Input. Regardless of relationship strength setting, deleting a parent feature will not delete child items. This leads to orphans in the related table.

jfdarveau commented 3 months ago

I just encountered the same issue and I would like to add that when adding a child feature into a form, it seems to be saved immediately regardless of the fact that the parent feature hasn't been saved yet. Cancelling the parent form doesn't delete the child feature and the foreign key pointing to the nonexistent parent feature is still present in the attribute table. I'm my opinion, this problem should be taken seriously because it may leave many orphan objects into child tables.