foodsoft/db/migrate/022_add_required_user_for_task.rb

15 lines
543 B
Ruby
Raw Normal View History

class AddRequiredUserForTask < ActiveRecord::Migration[4.2]
2009-01-06 11:49:19 +01:00
def self.up
add_column :tasks, :required_users, :integer, :default => 1
add_column :groups, :task_required_users, :integer, :default => 1
# add default values to every task and group
Task.find(:all).each { |task| task.update_attribute :required_users, 1 }
Group.workgroups.each { |group| group.update_attribute :task_required_users, 1 }
end
def self.down
remove_column :tasks, :required_users
remove_column :groups, :tasks_required_users
end
end