about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200721195456_add_index_on_statuses_visibility.rb7
-rw-r--r--db/schema.rb3
2 files changed, 9 insertions, 1 deletions
diff --git a/db/migrate/20200721195456_add_index_on_statuses_visibility.rb b/db/migrate/20200721195456_add_index_on_statuses_visibility.rb
new file mode 100644
index 000000000..c45405e95
--- /dev/null
+++ b/db/migrate/20200721195456_add_index_on_statuses_visibility.rb
@@ -0,0 +1,7 @@
+class AddIndexOnStatusesVisibility < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def change
+    add_index :statuses, :visibility, where: 'deleted_at IS NULL', algorithm: :concurrently, name: :index_statuses_on_visibility
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index aa0790fc6..674ff8ab6 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2020_07_21_184347) do
+ActiveRecord::Schema.define(version: 2020_07_21_195456) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -811,6 +811,7 @@ ActiveRecord::Schema.define(version: 2020_07_21_184347) do
     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"
     t.index ["uri"], name: "index_statuses_on_uri", unique: true
+    t.index ["visibility"], name: "index_statuses_on_visibility", where: "(deleted_at IS NULL)"
   end
 
   create_table "statuses_tags", id: false, force: :cascade do |t|