]> cat aescling's git repositories - mastodon.git/commitdiff
Add index favourites on account_id and id (#4360)
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Wed, 26 Jul 2017 01:35:25 +0000 (10:35 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 26 Jul 2017 01:35:25 +0000 (03:35 +0200)
db/migrate/20170720000000_add_index_favourites_on_account_id_and_id.rb [new file with mode: 0644]
db/schema.rb

diff --git a/db/migrate/20170720000000_add_index_favourites_on_account_id_and_id.rb b/db/migrate/20170720000000_add_index_favourites_on_account_id_and_id.rb
new file mode 100644 (file)
index 0000000..9990358
--- /dev/null
@@ -0,0 +1,6 @@
+class AddIndexFavouritesOnAccountIdAndId < ActiveRecord::Migration[5.1]
+  def change
+    # Used to query favourites of an account ordered by id.
+    add_index :favourites, [:account_id, :id]
+  end
+end
index cf7b0722fc31b9e43b26bbb77e73111453456e96..2501e451d0d08141757a843aeed786760dde3255 100644 (file)
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 20170718211102) do
+ActiveRecord::Schema.define(version: 20170720000000) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -103,6 +103,7 @@ ActiveRecord::Schema.define(version: 20170718211102) do
     t.integer "status_id", null: false
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false
+    t.index ["account_id", "id"], name: "index_favourites_on_account_id_and_id"
     t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true
     t.index ["status_id"], name: "index_favourites_on_status_id"
   end