tracks/db/migrate/20090531111711_add_show_always_to_recurring_todo.rb
piglop 4e1e18da0f fixed #781:
* added a "show always" radio to the recurring todo forms
* added a show_always flag to recurring todos
* created a migration to convert existing recurring todos where show_from_delta==0
* recurring todos where show_from_delta is 0 are now shown the same day they're due

Signed-off-by: Reinier Balt <lrbalt@gmail.com>
2009-06-03 01:36:20 +08:00

16 lines
478 B
Ruby

class AddShowAlwaysToRecurringTodo < ActiveRecord::Migration
def self.up
add_column :recurring_todos, :show_always, :boolean
recurring_todos = RecurringTodo.find(:all)
recurring_todos.each do |recurring_todo|
if recurring_todo.show_from_delta == 0 or recurring_todo.show_from_delta.nil?
recurring_todo.show_always = true
recurring_todo.save!
end
end
end
def self.down
remove_column :recurring_todos, :show_always
end
end