Commit 69c8231b49a8179697070d528d36811dc2f335e6

Authored by Dmitriy Zaporozhets
1 parent 96af55bb

index for commit_id. Schema rebuiled. Non rollback migration exception added

db/migrate/20121218164840_move_noteable_commit_to_own_field.rb
... ... @@ -15,7 +15,6 @@ class MoveNoteableCommitToOwnField < ActiveRecord::Migration
15 15 end
16 16  
17 17 def down
18   - remove_column :notes, :commit_id
19   - remove_column :notes, :new_noteable_id
  18 + raise ActiveRecord::IrreversibleMigration
20 19 end
21 20 end
... ...
db/migrate/20121219095402_indices_for_notes.rb 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +class IndicesForNotes < ActiveRecord::Migration
  2 + def change
  3 + add_index :notes, :commit_id
  4 + add_index :notes, [:project_id, :noteable_type]
  5 + end
  6 +end
... ...
db/schema.rb
... ... @@ -11,7 +11,7 @@
11 11 #
12 12 # It's strongly recommended to check this file into your version control system.
13 13  
14   -ActiveRecord::Schema.define(:version => 20121218164840) do
  14 +ActiveRecord::Schema.define(:version => 20121219095402) do
15 15  
16 16 create_table "events", :force => true do |t|
17 17 t.string "target_type"
... ... @@ -69,19 +69,19 @@ ActiveRecord::Schema.define(:version =&gt; 20121218164840) do
69 69 add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
70 70  
71 71 create_table "merge_requests", :force => true do |t|
72   - t.string "target_branch", :null => false
73   - t.string "source_branch", :null => false
74   - t.integer "project_id", :null => false
  72 + t.string "target_branch", :null => false
  73 + t.string "source_branch", :null => false
  74 + t.integer "project_id", :null => false
75 75 t.integer "author_id"
76 76 t.integer "assignee_id"
77 77 t.string "title"
78   - t.boolean "closed", :default => false, :null => false
79   - t.datetime "created_at", :null => false
80   - t.datetime "updated_at", :null => false
81   - t.text "st_commits"
82   - t.text "st_diffs"
83   - t.boolean "merged", :default => false, :null => false
84   - t.integer "state", :default => 1, :null => false
  78 + t.boolean "closed", :default => false, :null => false
  79 + t.datetime "created_at", :null => false
  80 + t.datetime "updated_at", :null => false
  81 + t.text "st_commits", :limit => 2147483647
  82 + t.text "st_diffs", :limit => 2147483647
  83 + t.boolean "merged", :default => false, :null => false
  84 + t.integer "state", :default => 1, :null => false
85 85 t.integer "milestone_id"
86 86 end
87 87  
... ... @@ -135,8 +135,10 @@ ActiveRecord::Schema.define(:version =&gt; 20121218164840) do
135 135 t.integer "noteable_id"
136 136 end
137 137  
  138 + add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id"
138 139 add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
139 140 add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
  141 + add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type"
140 142 add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
141 143  
142 144 create_table "projects", :force => true do |t|
... ...