Skip to content

Commit

Permalink
Ensure event.draft_saved is 'false' instead of 'nil'
Browse files Browse the repository at this point in the history
  • Loading branch information
tjgrathwell committed Aug 13, 2015
1 parent e02c947 commit 155c852
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class EnsureDraftSavedIsFalseInsteadOfNil < ActiveRecord::Migration
class Event < ActiveRecord::Base; end

def up
change_column_default :events, :draft_saved, false
Event.find_each do |e|
e.update_attribute(:draft_saved, false) if e.draft_saved.nil?
end
end

def down
change_column_default :events, :draft_saved, nil
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150726194812) do
ActiveRecord::Schema.define(version: 20150813035954) do

create_table "authentications", force: :cascade do |t|
t.integer "user_id"
Expand Down Expand Up @@ -110,7 +110,7 @@
t.boolean "has_childcare", default: true
t.boolean "restrict_operating_systems", default: false
t.string "allowed_operating_system_ids"
t.boolean "draft_saved"
t.boolean "draft_saved", default: false
t.integer "volunteer_rsvp_limit"
t.integer "volunteer_waitlist_rsvps_count", default: 0
t.string "target_audience"
Expand Down

0 comments on commit 155c852

Please sign in to comment.