- Softwrap mode:
- Toggle
Blob of db/migrate/020_add_project_id_to_comments.rb
(raw blob data)
| 1 | class AddProjectIdToComments < ActiveRecord::Migration |
| 2 | def self.up |
| 3 | add_column :comments, :project_id, :integer |
| 4 | add_index :comments, :project_id |
| 5 | ActiveRecord::Base::reset_column_information |
| 6 | |
| 7 | Comment.find(:all).each do |comment| |
| 8 | comment.update_attributes(:project_id => comment.repository.project_id) |
| 9 | end |
| 10 | end |
| 11 | |
| 12 | def self.down |
| 13 | remove_column :comments, :project_id |
| 14 | end |
| 15 | end |
