Commit 9c4f6041f607159ee74bbded0fd9809c1606f545
1 parent
131144ba
Exists in
master
and in
29 other branches
schema: add index for article and profile search order filters
(ActionItem3039)
Showing
3 changed files
with
27 additions
and
1 deletions
Show diff stats
db/migrate/20140312132212_add_indexes_for_article_search.rb
0 → 100644
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +class AddIndexesForArticleSearch < ActiveRecord::Migration | ||
2 | + def self.up | ||
3 | + add_index :articles, :created_at | ||
4 | + add_index :articles, :hits | ||
5 | + add_index :articles, :comments_count | ||
6 | + end | ||
7 | + | ||
8 | + def self.down | ||
9 | + remove_index :articles, :created_at | ||
10 | + remove_index :articles, :hits | ||
11 | + remove_index :articles, :comments_count | ||
12 | + end | ||
13 | +end |
db/migrate/20140312134218_add_indexes_for_profile_search.rb
0 → 100644
db/schema.rb
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | # | 9 | # |
10 | # It's strongly recommended to check this file into your version control system. | 10 | # It's strongly recommended to check this file into your version control system. |
11 | 11 | ||
12 | -ActiveRecord::Schema.define(:version => 20140108132730) do | 12 | +ActiveRecord::Schema.define(:version => 20140312151857) do |
13 | 13 | ||
14 | create_table "abuse_reports", :force => true do |t| | 14 | create_table "abuse_reports", :force => true do |t| |
15 | t.integer "reporter_id" | 15 | t.integer "reporter_id" |
@@ -140,6 +140,9 @@ ActiveRecord::Schema.define(:version => 20140108132730) do | @@ -140,6 +140,9 @@ ActiveRecord::Schema.define(:version => 20140108132730) do | ||
140 | t.integer "position" | 140 | t.integer "position" |
141 | end | 141 | end |
142 | 142 | ||
143 | + add_index "articles", ["comments_count"], :name => "index_articles_on_comments_count" | ||
144 | + add_index "articles", ["created_at"], :name => "index_articles_on_created_at" | ||
145 | + add_index "articles", ["hits"], :name => "index_articles_on_hits" | ||
143 | add_index "articles", ["name"], :name => "index_articles_on_name" | 146 | add_index "articles", ["name"], :name => "index_articles_on_name" |
144 | add_index "articles", ["parent_id"], :name => "index_articles_on_parent_id" | 147 | add_index "articles", ["parent_id"], :name => "index_articles_on_parent_id" |
145 | add_index "articles", ["profile_id"], :name => "index_articles_on_profile_id" | 148 | add_index "articles", ["profile_id"], :name => "index_articles_on_profile_id" |
@@ -467,6 +470,7 @@ ActiveRecord::Schema.define(:version => 20140108132730) do | @@ -467,6 +470,7 @@ ActiveRecord::Schema.define(:version => 20140108132730) do | ||
467 | t.string "redirection_after_login" | 470 | t.string "redirection_after_login" |
468 | end | 471 | end |
469 | 472 | ||
473 | + add_index "profiles", ["created_at"], :name => "index_profiles_on_created_at" | ||
470 | add_index "profiles", ["environment_id"], :name => "index_profiles_on_environment_id" | 474 | add_index "profiles", ["environment_id"], :name => "index_profiles_on_environment_id" |
471 | add_index "profiles", ["identifier"], :name => "index_profiles_on_identifier" | 475 | add_index "profiles", ["identifier"], :name => "index_profiles_on_identifier" |
472 | add_index "profiles", ["region_id"], :name => "index_profiles_on_region_id" | 476 | add_index "profiles", ["region_id"], :name => "index_profiles_on_region_id" |