Commit 8ac7cfd68dcc9d69dab5e06109a390e89103f5ac
1 parent
32510c0a
Exists in
master
and in
29 other branches
Removing nil values from products' highlighted attribute
(ActionItem2599)
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
db/migrate/20130304200849_add_default_value_to_product_highlighted.rb
0 → 100644
@@ -0,0 +1,10 @@ | @@ -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,7 +9,7 @@ | ||
9 | # | 9 | # |
10 | # It's strongly recommended to check this file into your version control system. | 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 | create_table "abuse_reports", :force => true do |t| | 14 | create_table "abuse_reports", :force => true do |t| |
15 | t.integer "reporter_id" | 15 | t.integer "reporter_id" |
@@ -415,7 +415,7 @@ ActiveRecord::Schema.define(:version => 20130111232201) do | @@ -415,7 +415,7 @@ ActiveRecord::Schema.define(:version => 20130111232201) do | ||
415 | t.datetime "updated_at" | 415 | t.datetime "updated_at" |
416 | t.decimal "discount" | 416 | t.decimal "discount" |
417 | t.boolean "available", :default => true | 417 | t.boolean "available", :default => true |
418 | - t.boolean "highlighted" | 418 | + t.boolean "highlighted", :default => false |
419 | t.integer "unit_id" | 419 | t.integer "unit_id" |
420 | t.integer "image_id" | 420 | t.integer "image_id" |
421 | end | 421 | end |