From 9a07b50e07d2d2e3092b1b45e1eeb23016f0b362 Mon Sep 17 00:00:00 2001 From: Allen Zhong Date: Wed, 2 Oct 2019 18:02:28 +0800 Subject: [PATCH] fix status index to allow retoots and replies in local timeline --- db/migrate/20190823221802_add_local_index_to_statuses.rb | 2 +- db/schema.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20190823221802_add_local_index_to_statuses.rb b/db/migrate/20190823221802_add_local_index_to_statuses.rb index deca25c3515ef1..ac8c779397dfb5 100644 --- a/db/migrate/20190823221802_add_local_index_to_statuses.rb +++ b/db/migrate/20190823221802_add_local_index_to_statuses.rb @@ -2,7 +2,7 @@ class AddLocalIndexToStatuses < ActiveRecord::Migration[5.2] disable_ddl_transaction! def up - add_index :statuses, [:id, :account_id], name: :index_statuses_local_20190824, algorithm: :concurrently, order: { id: :desc }, where: '(local OR (uri IS NULL)) AND deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))' + add_index :statuses, [:id, :account_id], name: :index_statuses_local_20190824, algorithm: :concurrently, order: { id: :desc }, where: '(local OR (uri IS NULL)) AND deleted_at IS NULL AND visibility = 0' end def down diff --git a/db/schema.rb b/db/schema.rb index 69301970a6351c..388c313e8c425c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -689,7 +689,7 @@ t.bigint "poll_id" t.datetime "deleted_at" t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)" - t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))" + t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0)" t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id" t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id" t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id"