From 1ac9a2d7bde7986c4411ee37666e0951edd033ac Mon Sep 17 00:00:00 2001 From: Molly Struve Date: Fri, 27 Dec 2019 08:57:40 -0600 Subject: [PATCH] add index to created_at for notifications (#5251) [deploy] --- ...20191226202114_add_created_at_index_to_notifications.rb | 7 +++++++ db/schema.rb | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20191226202114_add_created_at_index_to_notifications.rb diff --git a/db/migrate/20191226202114_add_created_at_index_to_notifications.rb b/db/migrate/20191226202114_add_created_at_index_to_notifications.rb new file mode 100644 index 000000000..6ffd7a917 --- /dev/null +++ b/db/migrate/20191226202114_add_created_at_index_to_notifications.rb @@ -0,0 +1,7 @@ +class AddCreatedAtIndexToNotifications < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + add_index :notifications, :created_at, algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index d290bfc56..258af4354 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: 2019_12_23_202251) do +ActiveRecord::Schema.define(version: 2019_12_26_202114) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -569,6 +569,7 @@ ActiveRecord::Schema.define(version: 2019_12_23_202251) do t.boolean "read", default: false t.datetime "updated_at", null: false t.integer "user_id" + t.index ["created_at"], name: "index_notifications_on_created_at" t.index ["json_data"], name: "index_notifications_on_json_data", using: :gin t.index ["notifiable_id"], name: "index_notifications_on_notifiable_id" t.index ["notifiable_type"], name: "index_notifications_on_notifiable_type"