Consolidate Elasticsearch application settings into one JSON field
Description
This consolidates (most of the) Elasticsearch application settings into one JSONB field.
We are migrating 21 columns and skipping the following Elasticsearch columns:
-
elasticsearch_url
- because we have multiple errors moving this field. !174529 (closed) tried to solve this, but we still have CI errors that we cannot reproduce locally. - 4
encrypted_elasticsearch_*
- because they useattr_encrypted
gem. We are unsure if both accessors are compatible and want to minimize the risk.
Database migrations
It includes three database migrations:
- Migration to add the
elasticsearch
JSONB column - Migration to copy the values from the different columns into the newly created column
- Post-migration to remove the original columns
Testing
Steps to test these changes:
- Run the database migrations:
rails db:migrate
- Add a License http://localhost:3000/admin/application_settings/general#js-add-license-toggle
- Test/Modify the Elasticsearch settings http://localhost:3000/admin/application_settings/advanced_search#js-elasticsearch-settings
- Review the database data with
rails console
by runningApplicationSetting.current_without_cache.elasticsearch
Related to #500267 (closed)
Edited by Arturo Herrero