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

Add migration to remove obsolete settings (facets_enabled_collection … #2204

Merged

Conversation

dbernstein
Copy link
Contributor

…and facets_default_collection).

Description

This is a follow-up PR to clean-up obsolete settings removed in #2182

Motivation and Context

How Has This Been Tested?

Checklist

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

@jonathangreen jonathangreen added the DB migration This PR contains a DB migration label Dec 3, 2024
Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

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

Need to update the table this migration is targeting, see comment on PR.

Comment on lines 20 to 23
conn.execute(
"UPDATE integration_library_configurations set settings = settings::jsonb - 'facets_enabled_collection'"
)
conn.execute(
"UPDATE integration_library_configurations set settings = settings::jsonb - 'facets_default_collection'"
)
Copy link
Member

Choose a reason for hiding this comment

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

These settings are stored in the libraries table, not the integration_library_configurations table.

Minor: You can also do the update in a single update statement and without using a cast to jsonb since the column already has that datatype.

Suggested change
conn.execute(
"UPDATE integration_library_configurations set settings = settings::jsonb - 'facets_enabled_collection'"
)
conn.execute(
"UPDATE integration_library_configurations set settings = settings::jsonb - 'facets_default_collection'"
)
conn.execute(
"UPDATE libraries set settings_dict = "
"settings_dict - array['facets_enabled_collection', 'facets_default_collection']"
)

@dbernstein
Copy link
Contributor Author

@jonathangreen : I'll upgrade the migration target once I've merged in the new events PR which also has a migration.

@dbernstein dbernstein force-pushed the migration-to-remove-collection-facet-settings-from-db branch from b446928 to 8de86bc Compare December 11, 2024 19:55
@dbernstein dbernstein force-pushed the migration-to-remove-collection-facet-settings-from-db branch from 8de86bc to 336ec92 Compare December 11, 2024 23:07
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.09%. Comparing base (ec00a8e) to head (336ec92).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2204   +/-   ##
=======================================
  Coverage   91.09%   91.09%           
=======================================
  Files         363      363           
  Lines       41201    41201           
  Branches     8827     8827           
=======================================
  Hits        37531    37531           
  Misses       2406     2406           
  Partials     1264     1264           

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

Copy link
Member

@jonathangreen jonathangreen 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

@dbernstein dbernstein merged commit c94cfb0 into main Dec 12, 2024
21 checks passed
@dbernstein dbernstein deleted the migration-to-remove-collection-facet-settings-from-db branch December 12, 2024 18:07
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