Commit 8ac7cfd68dcc9d69dab5e06109a390e89103f5ac

Authored by Rodrigo Souto
1 parent 32510c0a

Removing nil values from products' highlighted attribute

(ActionItem2599)
db/migrate/20130304200849_add_default_value_to_product_highlighted.rb 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +class AddDefaultValueToProductHighlighted < ActiveRecord::Migration
  2 + def self.up
  3 + change_column :products, :highlighted, :boolean, :default => false
  4 + execute('UPDATE products SET highlighted="f" WHERE highlighted IS NULL;')
  5 + end
  6 +
  7 + def self.down
  8 + say 'This migraiton is not reversible!'
  9 + end
  10 +end
... ...
db/schema.rb
... ... @@ -9,7 +9,7 @@
9 9 #
10 10 # It's strongly recommended to check this file into your version control system.
11 11  
12   -ActiveRecord::Schema.define(:version => 20130111232201) do
  12 +ActiveRecord::Schema.define(:version => 20130304200849) do
13 13  
14 14 create_table "abuse_reports", :force => true do |t|
15 15 t.integer "reporter_id"
... ... @@ -415,7 +415,7 @@ ActiveRecord::Schema.define(:version =&gt; 20130111232201) do
415 415 t.datetime "updated_at"
416 416 t.decimal "discount"
417 417 t.boolean "available", :default => true
418   - t.boolean "highlighted"
  418 + t.boolean "highlighted", :default => false
419 419 t.integer "unit_id"
420 420 t.integer "image_id"
421 421 end
... ...