search: fix order:note, order:comment_bumped to use indexes.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
class FixLastNotedAtIndexOnPosts < ActiveRecord::Migration
|
||||
def up
|
||||
Post.without_timeout do
|
||||
remove_index :posts, column: :last_comment_bumped_at
|
||||
add_index :posts, :last_comment_bumped_at, order: "DESC NULLS LAST"
|
||||
|
||||
remove_index :posts, column: :last_noted_at
|
||||
add_index :posts, :last_noted_at, order: "DESC NULLS LAST"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6896,14 +6896,14 @@ CREATE INDEX index_posts_on_image_width ON posts USING btree (image_width);
|
||||
-- Name: index_posts_on_last_comment_bumped_at; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_posts_on_last_comment_bumped_at ON posts USING btree (last_comment_bumped_at);
|
||||
CREATE INDEX index_posts_on_last_comment_bumped_at ON posts USING btree (last_comment_bumped_at DESC NULLS LAST);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_posts_on_last_noted_at; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_posts_on_last_noted_at ON posts USING btree (last_noted_at);
|
||||
CREATE INDEX index_posts_on_last_noted_at ON posts USING btree (last_noted_at DESC NULLS LAST);
|
||||
|
||||
|
||||
--
|
||||
@@ -7545,3 +7545,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170512221200');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20170515235205');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20170519204506');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user