Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement check_dependencies and automatic relation clean up #1683

Open
xhero opened this issue Dec 3, 2024 · 0 comments
Open

Reimplement check_dependencies and automatic relation clean up #1683

xhero opened this issue Dec 3, 2024 · 0 comments
Assignees
Labels

Comments

@xhero
Copy link
Contributor

xhero commented Dec 3, 2024

When a record is deleted before_destroy :check_dependencies is run, which avoids deleting the record if another one is pointing to it (referring_* relations, i.e. a source is deleted and a work is pointing to it).
check_dependencies works reasonably well for Sources, but in other cases (ex. People) it will include also relations that are not referring_*, for example having the tag 510 in a Person will trigger the dependency on Institution (not the referring one!), which should be cleaned up automatically. Moreover non-marc records are not included at all, so for example the links to Places are not taken care of at all, leaving dangling links in the database.
The functionality needs to be restructured so that only referring_* relations are taken in account and also eventual non-marc models.
The second part of the problem is that relations are cleaned up automatically only for Sources (deleting a source will delete all the references it had), but not necessarily for other methods (hence the Place link stays when a Person is deleted). This functionality needs to be unified across models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants