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

Remove old columns from collection table #1498

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

jonathangreen
Copy link
Member

@jonathangreen jonathangreen commented Nov 3, 2023

Description

This is now ready for review, since #1494 is in the v12.1.0 release.

Motivation and Context

Clean up leftover columns, once #1494 has gone into a release, and we know that we are not rolling it back.

How Has This Been Tested?

  • Running tests in CI.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@jonathangreen jonathangreen force-pushed the feature/remove-external-integration-collection branch 2 times, most recently from 2a439b9 to eafb469 Compare November 3, 2023 17:35
Base automatically changed from feature/remove-external-integration-collection to main November 17, 2023 13:58
jonathangreen added a commit that referenced this pull request Nov 17, 2023
…1494)

This PR changes the data model for our collections in a number of ways with the goal of removing all reliance on external integrations from our collections.

All the database columns and tables "removed" by this PR have just been renamed on the Python side, but left in place for now. Once this goes into a release #1498 can be merged to remove the now unused tables and columns.

The major changes:

    The external_integration_id column has been removed.
    Collections no longer have a name column.
        Previously both integrations and collections had names, this meant that they could get out of sync. Now collection names are driven by the name of their integration. A migration handles making sure that the existing integrations that have gotten out of sync are updated to have their collections name.
    The collections_libraries table has been removed.
        Collections used to be able to be related to libraries in two ways: through the collections_libraries table, and via their integration_library_configuration. This situation was confusing, and meant that these could get out of sync.
    The collection table no longer uses its external_account_id column. This was duplicated between the table and the settings before, it now lives only in the settings. As with the others the column is still present, but is renamed and unused and will be dropped once this is rolled out everywhere.
    The settings column get a gin index, to make it easier to query the jsonb column.
    Some of the properties on the collection class have been moved out to the specific license provider API that used them. These were on the collection model because previously some providers didn't have their own API classes.
        There are still some of these that could be moved into a more suitable location, but that can happen in a follow up PR.
    The collection controller and collection self test controller have been updated to use the integration settings controller base classes. This lets us keep all the logic for updating these settings isolated there. The biggest consequence of this change is that we now pass around the integration ID rather then the collection ID when referencing collections and collection self tests.
        This is transparent to the admin UI, since it just sends back the IDs given to it when it queries for the collection settings.
        This makes the collection controllers act like the other controllers that modify integrations, rather then using different IDs in the collection controller.
    The collection self test controller removes the special case that used to exist for OPDS importer collections, since they now have their own API class.
        This PR removes the self test functionality for the OPDS 1.x importer class, since we don't have any OPDS 1.x collections in our production CMs. Here is a ticket to add self tests for the collection classes missing them (OPDS 2, OPDS 2 + ODL), but this is the situation we've been in for awhile, so no impact from this PR. This PR will make it easier to add these self tests by just implementing the self test interface in the api classes.
        There is also a DB migration to apply these database changes and an associated migration test.
    All the major files touched by this PR are now fully type hinted, and added to the strict mypy group in pyproject.toml.
@jonathangreen jonathangreen force-pushed the feature/remove-unused-collection-columns branch from b63457a to 1eca9fc Compare November 17, 2023 14:01
@jonathangreen jonathangreen added the DB migration This PR contains a DB migration label Nov 27, 2023
@jonathangreen jonathangreen marked this pull request as ready for review November 27, 2023 19:47
@jonathangreen jonathangreen force-pushed the feature/remove-unused-collection-columns branch 2 times, most recently from e8c6e32 to 119215b Compare November 28, 2023 01:05
@jonathangreen jonathangreen requested a review from a team November 28, 2023 14:03
Copy link
Contributor

@RishiDiwanTT RishiDiwanTT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good 👍

@jonathangreen jonathangreen force-pushed the feature/remove-unused-collection-columns branch from 119215b to 3265bb0 Compare November 29, 2023 13:52
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (18df5d5) 90.19% compared to head (3265bb0) 90.19%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1498   +/-   ##
=======================================
  Coverage   90.19%   90.19%           
=======================================
  Files         233      233           
  Lines       28220    28216    -4     
  Branches     6485     6485           
=======================================
- Hits        25452    25449    -3     
  Misses       1823     1823           
+ Partials      945      944    -1     
Flag Coverage Δ
Api 75.79% <ø> (-0.01%) ⬇️
Core 59.57% <ø> (-0.01%) ⬇️
migration 29.78% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonathangreen jonathangreen merged commit a99a74f into main Nov 29, 2023
30 checks passed
@jonathangreen jonathangreen deleted the feature/remove-unused-collection-columns branch November 29, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DB migration This PR contains a DB migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants