about summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-01-14 13:06:18 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-01-14 13:06:18 -0500
commit30cd66e1521bc760df45908adb2f7d3ba6683900 (patch)
treeb730fbfc687516be2e4df95250d02598e9e7fa73 /test
parent91eeaa33a436ba2233f1fe7509f7c104db1d4533 (diff)
downloadpokeviewer-30cd66e1521bc760df45908adb2f7d3ba6683900.tar.gz
pokeviewer-30cd66e1521bc760df45908adb2f7d3ba6683900.tar.bz2
pokeviewer-30cd66e1521bc760df45908adb2f7d3ba6683900.zip
Cached a Pokémon's latest revision
This removes the need to use a GROUP or DISTINCT in eager-loading Pokémon on the front page. It duplicates data, but provisions are in place to keep the cache up-to-date. When a Pokémon record is updated, it is required that its cache points to the current revision. When a revision is created, it updates the Pokémon's cache to point to it, because a new revision will always be the most recent one, and it is impossible to reorder revisions.

This does not affect the number of queries used on the front page (see #1).

refs #4
Diffstat (limited to 'test')
-rw-r--r--test/dummy/db/schema.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 9752892..5f8c1c0 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb
@@ -10,7 +10,7 @@
10# 10#
11# It's strongly recommended that you check this file into your version control system. 11# It's strongly recommended that you check this file into your version control system.
12 12
13ActiveRecord::Schema.define(version: 20180113200119) do 13ActiveRecord::Schema.define(version: 20180114170238) do
14 14
15 create_table "pokeviewer_abilities", force: :cascade do |t| 15 create_table "pokeviewer_abilities", force: :cascade do |t|
16 t.string "name", limit: 191, null: false 16 t.string "name", limit: 191, null: false
@@ -76,6 +76,8 @@ ActiveRecord::Schema.define(version: 20180113200119) do
76 t.integer "slot" 76 t.integer "slot"
77 t.integer "location_id" 77 t.integer "location_id"
78 t.string "pokeball", null: false 78 t.string "pokeball", null: false
79 t.integer "current_id"
80 t.index ["current_id"], name: "index_pokeviewer_pokemon_on_current_id"
79 t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true 81 t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true
80 t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id" 82 t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id"
81 t.index ["uuid"], name: "index_pokeviewer_pokemon_on_uuid", unique: true 83 t.index ["uuid"], name: "index_pokeviewer_pokemon_on_uuid", unique: true