Remove redundant owner index from devices table

The unique (owner_type, owner_id, token) index already serves queries
filtering by (owner_type, owner_id) via its leftmost prefix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Rosa Gutierrez
2026-01-21 20:45:13 +01:00
parent ab6bc256eb
commit 92f283c4d9
2 changed files with 5 additions and 1 deletions
@@ -0,0 +1,5 @@
class RemoveRedundantOwnerIndexFromActionPushNativeDevices < ActiveRecord::Migration[8.2]
def change
remove_index :action_push_native_devices, column: [ :owner_type, :owner_id ]
end
end
Generated
-1
View File
@@ -79,7 +79,6 @@ ActiveRecord::Schema[8.2].define(version: 2026_02_18_120000) do
t.string "token", null: false
t.datetime "updated_at", null: false
t.index ["owner_type", "owner_id", "token"], name: "idx_on_owner_type_owner_id_token_95a4008c64", unique: true
t.index ["owner_type", "owner_id"], name: "index_action_push_native_devices_on_owner"
t.index ["session_id"], name: "index_action_push_native_devices_on_session_id"
end