Index notifications on updated_at

As we now update notifications with unread counts we sort them by the
time they were updated instead of when they were created. To keep that
performant we also have to change the previous indices that used
created_at to use updated_at.
This commit is contained in:
Stanko K.R.
2026-02-12 11:36:35 +01:00
parent 61144667fc
commit 22276a25c8
3 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.2].define(version: 2026_02_11_122517) do
ActiveRecord::Schema[8.2].define(version: 2026_02_12_102026) do
create_table "accesses", id: :uuid, force: :cascade do |t|
t.datetime "accessed_at"
t.uuid "account_id", null: false
@@ -398,7 +398,7 @@ ActiveRecord::Schema[8.2].define(version: 2026_02_11_122517) do
t.index ["creator_id"], name: "index_notifications_on_creator_id"
t.index ["source_type", "source_id"], name: "index_notifications_on_source"
t.index ["user_id", "card_id"], name: "index_notifications_on_user_id_and_card_id", unique: true
t.index ["user_id", "read_at", "created_at"], name: "index_notifications_on_user_id_and_read_at_and_created_at", order: { read_at: :desc, created_at: :desc }
t.index ["user_id", "read_at", "updated_at"], name: "index_notifications_on_user_id_and_read_at_and_updated_at", order: { read_at: :desc, updated_at: :desc }
t.index ["user_id"], name: "index_notifications_on_user_id"
end