Merge #​2667 "Work around bug in migrations to non-null columns"

This commit is contained in:
Andrew Kvalheim 2020-06-26 20:19:40 -07:00
commit 3f1c8068ee
2 changed files with 5 additions and 1 deletions

View file

@ -6,6 +6,8 @@ class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration[4.2]
end
def change
TmpTrack.reset_column_information
TmpTrack.where(state: nil).each do |track|
track.state = 'confirmed'
track.save!

View file

@ -6,11 +6,13 @@ class MakeTrackCfpActiveNotNull < ActiveRecord::Migration[4.2]
end
def change
TmpTrack.reset_column_information
TmpTrack.where(cfp_active: nil).each do |track|
track.cfp_active = true
track.save!
end
change_column_null :tracks, :cfp_active, false
change_column :tracks, :cfp_active, :boolean, null: false, default: false
end
end