NYPL-Simplified / server_core

Shared data model and utilities for Library Simplified server applications
7 stars 11 forks source link

When a library is removed from a collection, its configuration for that collection is completely deleted #1237

Closed leonardr closed 3 years ago

leonardr commented 3 years ago

This branch partially addresses https://jira.nypl.org/browse/SIMPLY-3504; I also have a circulation branch for it at https://github.com/NYPL-Simplified/circulation/pull/1553.

Basically, if you disassociate a library from a collection, you should call Collection.disassociate_library, which takes care of clearing that library's configuration settings for the collection. Deleting a collection disassociates every library from the collection and deletes the corresponding ExternalIntegration.

I don't think this is causing any serious problem, but there is an inconsistency in the way we handle ConfigurationSettings when the things being configured are deleted, and my other PR https://github.com/NYPL-Simplified/server_core/pull/1235 might turn this into a real problem by making it difficult to recreate a collection after deleting it.

leonardr commented 3 years ago

I think we'll be OK. The migration script for #1235 will delete any duplicates, so we'll be left with what looks like some weird sitewide settings (no externalintegration_id or library_id). Going forward, we won't be creating or using any of those fake sitewide settings, so they'll just be ignored.