Sha256: 78da0ca67247f9aad98135a06d0dc02002daf51d2a4e7174c6163dbde87637fe
Contents?: true
Size: 600 Bytes
Versions: 14
Compression:
Stored size: 600 Bytes
Contents
class AddColumnModeratorIdToGroup < ActiveRecord::Migration def up add_column :groups, :moderator_id, :integer Group.all.each do |group| if defined?(ThinkFeelDoDashboard::Moderator) moderator = ThinkFeelDoDashboard::Moderator.where(group_id: group.id).first else moderator = nil end if moderator group.update_attributes(moderator_id: moderator.user_id) else group.update_attributes(moderator_id: User.first.id) end group.save end end def down remove_column :groups, :moderator_id, :integer end end
Version data entries
14 entries across 14 versions & 1 rubygems