Mark track state as not null and add default value
The regular tracks are marked as 'confirmed'
This commit is contained in:
parent
fd93b04f16
commit
0f154d07c9
8 changed files with 32 additions and 13 deletions
|
|
@ -0,0 +1,14 @@
|
|||
class MakeTrackStateNotNullAndAddDefaultValue < ActiveRecord::Migration
|
||||
class TmpTrack < ActiveRecord::Base
|
||||
self.table_name = 'tracks'
|
||||
end
|
||||
|
||||
def change
|
||||
TmpTrack.where(state: nil).each do |track|
|
||||
track.state = 'confirmed'
|
||||
track.save!
|
||||
end
|
||||
|
||||
change_column :tracks, :state, :string, null: false, default: 'new'
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue