diff --git a/db/migrate/20150813035954_ensure_draft_saved_is_false_instead_of_nil.rb b/db/migrate/20150813035954_ensure_draft_saved_is_false_instead_of_nil.rb new file mode 100644 index 000000000..62114257f --- /dev/null +++ b/db/migrate/20150813035954_ensure_draft_saved_is_false_instead_of_nil.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 0a7d87689..227b88d35 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" @@ -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"