To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / db / migrate / 081_create_projects_trackers.rb @ 1298:4f746d8966dd

History | View | Annotate | Download (615 Bytes)

1 0:513646585e45 Chris
class CreateProjectsTrackers < ActiveRecord::Migration
2
  def self.up
3
    create_table :projects_trackers, :id => false do |t|
4
      t.column :project_id, :integer, :default => 0, :null => false
5
      t.column :tracker_id, :integer, :default => 0, :null => false
6
    end
7
    add_index :projects_trackers, :project_id, :name => :projects_trackers_project_id
8 909:cbb26bc654de Chris
9 0:513646585e45 Chris
    # Associates all trackers to all projects (as it was before)
10 1295:622f24f53b42 Chris
    tracker_ids = Tracker.all.collect(&:id)
11
    Project.all.each do |project|
12 0:513646585e45 Chris
      project.tracker_ids = tracker_ids
13
    end
14
  end
15
16
  def self.down
17
    drop_table :projects_trackers
18
  end
19
end