Add index for date in table diffs

master
Norore 2019-01-20 18:23:08 +01:00
parent eebc12625b
commit b284e3a2e0
2 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,9 @@
class AddCreationDayIndexToDiffs < ActiveRecord::Migration[5.2]
def up
add_index :diffs, "date_trunc('day', created_at) DESC", name: "diffs_creation_day_index"
end
def down
remove_index :diffs, name: "diffs_creation_day_index"
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_11_27_204747) do
ActiveRecord::Schema.define(version: 2019_01_20_155929) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -19,6 +19,7 @@ ActiveRecord::Schema.define(version: 2018_11_27_204747) do
t.json "content", null: false
t.bigint "site_id", null: false
t.datetime "created_at", null: false
t.index "date_trunc('day'::text, created_at) DESC", name: "diffs_creation_day_index"
t.index ["site_id"], name: "index_diffs_on_site_id"
end