Skip to content

Commit

Permalink
Delete calculator currency values from db [migration]
Browse files Browse the repository at this point in the history
This depends on openfoodfoundation#10318 being deployed first.
  • Loading branch information
dacook committed Jan 27, 2023
1 parent 428b589 commit 4a5e341
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class DeleteCalculatorCurrencyFromSpreePreferences < ActiveRecord::Migration[6.1]
class SpreePreference < ActiveRecord::Base
end

def up
# Delete all currency preferences for calculators, they are no longer used.
rows = SpreePreference.where("key like '/calculator%/currency/%'").delete_all
puts "#{rows} rows deleted."
end

def down
# Sorry, the data was deleted!
raise ActiveRecord::IrreversibleMigration
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_01_17_043628) do
ActiveRecord::Schema.define(version: 2023_01_26_233821) do

# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
Expand Down

0 comments on commit 4a5e341

Please sign in to comment.