Skip to content

Instantly share code, notes, and snippets.

@dpritchett
Created February 6, 2014 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpritchett/8854172 to your computer and use it in GitHub Desktop.
Save dpritchett/8854172 to your computer and use it in GitHub Desktop.
class DefaultVariantWeightToZero < ActiveRecord::Migration
def up
Spree::Variant.where(weight: nil).each do |v|
v.weight = 0
v.save
end
change_column :spree_variants, :weight, :decimal, precision: 8, scale: 2, default: 0.0
end
def down
change_column :spree_variants, :weight, :decimal, precision: 8, scale: 2
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment