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

Migrate all spree pref. keys to the new format #5660

Merged
merged 3 commits into from Jun 23, 2020

Conversation

sauloperez
Copy link
Contributor

@sauloperez sauloperez commented Jun 23, 2020

What? Why?

Added by Luis:
Closes #5657

We realized in Spree v2.1 they follow this format instead and this is what's causing issues to Katuma production.

This will remove the duplicate ones and convert the current preferences to the new thus, keeping the values.

spree/spree#3905 is exactly what happened to us.

What should we test?

All instance configurations should contain the correct values after running the migration.

Release notes

Fix the spree preferences keys to conform to Spree's v2.1 format

Changelog Category: Fixed

@sauloperez sauloperez self-assigned this Jun 23, 2020
We realized in Spree v2.1 they follow this format instead and this is
what's causing issues to Katuma production.

This will remove the duplicate ones and convert the current preferences
to the new thus, keeping the values.
@@ -0,0 +1,11 @@
class FixPreferencesKeys < ActiveRecord::Migration
def up
new_preferences = Spree::Preference.where("key like '/%'")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All keys that start with a slash got created today.

@Matt-Yorkley Matt-Yorkley added the dev-test A dev need to test this one label Jun 23, 2020
@luisramos0
Copy link
Contributor

I have to share I am a bit concerned about the deletes.
Do you see what happens if you run this migration twice?

@sauloperez sauloperez added the pr-staged-fr staging.coopcircuits.fr label Jun 23, 2020
We only migrate preferences if there are any to migrate.
So all preferences are fetch from DB now that they have changed.
@sauloperez
Copy link
Contributor Author

I added bit a of defensive coding as agreed on Slack plus the cache flush.

@sauloperez sauloperez merged commit 9e730e6 into openfoodfoundation:master Jun 23, 2020
sauloperez added a commit that referenced this pull request Jun 23, 2020
Migrate all spree pref. keys to the new format
@luisramos0 luisramos0 removed the pr-staged-fr staging.coopcircuits.fr label Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-test A dev need to test this one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User cant checkout - the app is not seeing the app settings stored in the DB
3 participants