Add data consistency migrations

This commit is contained in:
Petko Bordjukov 2016-10-11 03:55:49 +03:00
parent 858ec0f548
commit 6a404cdbe9
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,12 @@
class EventType < ActiveRecord::Base
end
class SetMinimalAndMaximalTimesForAllEventTypes < ActiveRecord::Migration
def up
EventType.where(minimum_length: nil).update_all(minimum_length: 0)
EventType.where(maximum_length: nil).update_all(maximum_length: 240)
end
def down
end
end

View File

@ -0,0 +1,11 @@
class Event < ActiveRecord::Base
end
class AddDescriptionsForAllEvents < ActiveRecord::Migration
def up
Event.where(description: [nil, '']).update_all(description: 'n/a')
end
def down
end
end