diff --git a/db/migrate/20210103150000_add_index_on_status_stats_created_at.rb b/db/migrate/20210103150000_add_index_on_status_stats_created_at.rb new file mode 100644 index 00000000..5acf3e25 --- /dev/null +++ b/db/migrate/20210103150000_add_index_on_status_stats_created_at.rb @@ -0,0 +1,7 @@ +class AddIndexOnStatusStatsCreatedAt < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + add_index :status_stats, :created_at, algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index 93225d24..6bb8bf98 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: 2021_01_02_225500) do +ActiveRecord::Schema.define(version: 2021_01_03_150000) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" @@ -730,6 +730,7 @@ ActiveRecord::Schema.define(version: 2021_01_02_225500) do t.bigint "favourites_count", default: 0, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["created_at"], name: "index_status_stats_on_created_at" t.index ["favourites_count"], name: "index_status_stats_on_favourites_count" t.index ["reblogs_count"], name: "index_status_stats_on_reblogs_count" t.index ["replies_count"], name: "index_status_stats_on_replies_count"