Updated

db/migrate / 20170615133536_nullify_previous_parliament_petition_duration.rb

A
17 lines of codes
2 methods
4.5 complexity/method
1 churn
8.93 complexity
0 duplications
class NullifyPreviousParliamentPetitionDuration < ActiveRecord::Migration
  1. NullifyPreviousParliamentPetitionDuration has no descriptive comment
class Parliament < ActiveRecord::Base; end
  1. NullifyPreviousParliamentPetitionDuration::Parliament has no descriptive comment
def up change_column_null(:parliaments, :petition_duration, true) parliament = Parliament.find_by!(opening_at: "2010-05-18T00:00:00".in_time_zone) parliament.update(petition_duration: nil) end def down parliament = Parliament.find_by!(opening_at: "2010-05-18T00:00:00".in_time_zone) parliament.update(petition_duration: 12) change_column_null(:parliaments, :petition_duration, false) end end