From 334fe35b1a404561e32130ad38755458a3631ceb Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 17 Jul 2013 17:33:34 +0600 Subject: [PATCH] add indexes to relations --- db/migrate/20130717112337_add_index_to_relation.rb | 6 ++++++ db/schema.rb | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20130717112337_add_index_to_relation.rb diff --git a/db/migrate/20130717112337_add_index_to_relation.rb b/db/migrate/20130717112337_add_index_to_relation.rb new file mode 100644 index 000000000..978d498bd --- /dev/null +++ b/db/migrate/20130717112337_add_index_to_relation.rb @@ -0,0 +1,6 @@ +class AddIndexToRelation < ActiveRecord::Migration + def change + add_index :relations, [:actor_type, :actor_id] + add_index :relations, [:target_type, :target_id] + end +end diff --git a/db/schema.rb b/db/schema.rb index e9a3b3bb5..f67c81e51 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130701121313) do +ActiveRecord::Schema.define(:version => 20130717112337) do create_table "activity_feeds", :force => true do |t| t.integer "user_id", :null => false @@ -450,6 +450,9 @@ ActiveRecord::Schema.define(:version => 20130701121313) do t.string "role" end + add_index "relations", ["actor_type", "actor_id"], :name => "index_relations_on_actor_type_and_actor_id" + add_index "relations", ["target_type", "target_id"], :name => "index_relations_on_target_type_and_target_id" + create_table "repositories", :force => true do |t| t.string "description", :null => false t.integer "platform_id", :null => false