osem-fcy/db/migrate/20170720134353_make_track_cfp_active_not_null.rb

17 lines
353 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class MakeTrackCfpActiveNotNull < ActiveRecord::Migration[4.2]
class TmpTrack < ActiveRecord::Base
self.table_name = 'tracks'
end
def change
TmpTrack.where(cfp_active: nil).each do |track|
track.cfp_active = true
track.save!
end
change_column_null :tracks, :cfp_active, false
end
end