rosa-build/db/migrate/20120306212914_add_project_...

15 lines
425 B
Ruby
Raw Normal View History

class AddProjectToComment < ActiveRecord::Migration
def up
add_column :comments, :project_id, :integer
Subscribe.reset_column_information
2014-01-21 04:51:49 +00:00
Comment.where(commentable_type: 'Grit::Commit').destroy_all
Comment.where(commentable_type: 'Issue').each do |comment|
comment.update_column(:project_id, comment.commentable.project.id)
end
end
def down
remove_column :comments, :project_id
end
end