From 92f283c4d91db2cabec902ea1b37e96559475335 Mon Sep 17 00:00:00 2001 From: Rosa Gutierrez Date: Wed, 21 Jan 2026 20:45:13 +0100 Subject: [PATCH] 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 --- ..._redundant_owner_index_from_action_push_native_devices.rb | 5 +++++ db/schema.rb | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20260121194404_remove_redundant_owner_index_from_action_push_native_devices.rb diff --git a/db/migrate/20260121194404_remove_redundant_owner_index_from_action_push_native_devices.rb b/db/migrate/20260121194404_remove_redundant_owner_index_from_action_push_native_devices.rb new file mode 100644 index 000000000..3c1392b44 --- /dev/null +++ b/db/migrate/20260121194404_remove_redundant_owner_index_from_action_push_native_devices.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index c9da93d98..1b562554d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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