Browse files

adding index on annotations

  • Loading branch information...
1 parent d56db29 commit fd59603fd9d913d8203f9deb64e82c72bbee80b3 @Bringo Bringo committed Jan 12, 2012
Showing with 11 additions and 1 deletion.
  1. +9 −0 db/migrate/20120112010455_add_index_for_annotations.rb
  2. +2 −1 db/schema.rb
View
9 db/migrate/20120112010455_add_index_for_annotations.rb
@@ -0,0 +1,9 @@
+class AddIndexForAnnotations < ActiveRecord::Migration
+ def self.up
+ add_index :annotations, [:container_id, :container_type]
+ end
+
+ def self.down
+ remove_index :annotations, [:container_id, :container_type]
+ end
+end
View
3 db/schema.rb
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120112005028) do
+ActiveRecord::Schema.define(:version => 20120112010455) do
create_table "annotations", :force => true do |t|
t.integer "container_id"
@@ -19,6 +19,7 @@
t.string "container_type"
end
+ add_index "annotations", ["container_id", "container_type"], :name => "index_annotations_on_container_id_and_container_type"
add_index "annotations", ["container_id"], :name => "index_annotation_on_instantiation_id"
create_table "asset_date_types", :force => true do |t|

0 comments on commit fd59603

Please sign in to comment.