mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
Replace hard-deleted prices with empty (0.00) price records
This commit is contained in:
11
db/migrate/20190913023137_replace_hard_deleted_prices.rb
Normal file
11
db/migrate/20190913023137_replace_hard_deleted_prices.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class ReplaceHardDeletedPrices < ActiveRecord::Migration
|
||||
def up
|
||||
ActiveRecord::Base.connection.execute(
|
||||
"INSERT into spree_prices (variant_id, amount, currency, deleted_at)
|
||||
SELECT spree_variants.id, '0.00', (SELECT value FROM spree_preferences WHERE key = 'spree/app_configuration/currency'), now()
|
||||
FROM spree_variants
|
||||
LEFT OUTER JOIN spree_prices ON (spree_variants.id = spree_prices.variant_id)
|
||||
WHERE spree_prices.id IS NULL;"
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user