diff --git a/db/migrate/20200623140437_fix_preferences_keys.rb b/db/migrate/20200623140437_fix_preferences_keys.rb new file mode 100644 index 0000000000..3f024ee278 --- /dev/null +++ b/db/migrate/20200623140437_fix_preferences_keys.rb @@ -0,0 +1,16 @@ +class FixPreferencesKeys < ActiveRecord::Migration + def up + unmigrated_preferences = Spree::Preference.exists?(['key NOT LIKE ?', '/%']) + return unless unmigrated_preferences + + new_preferences = Spree::Preference.where("key LIKE '/%'") + new_preferences.delete_all + + Spree::Preference.update_all("key = '/' || key") + + Rails.cache.clear + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index e2ec79428a..d166fdfd3c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20200508101630) do +ActiveRecord::Schema.define(version: 20200623140437) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql"