cirandas.net

ref: master

db/migrate/20130304200849_add_default_value_to_product_highlighted.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
class AddDefaultValueToProductHighlighted < ActiveRecord::Migration
  def self.up
    change_column :products, :highlighted, :boolean, :default => false
    execute('UPDATE products SET highlighted=(0>1) WHERE highlighted IS NULL;')
  end

  def self.down
    say 'This migraiton is not reversible!'
  end
end