Skip to content

Commit a31207a

Browse files
authored
Remove redundant db indexes (#4828)
1 parent b761496 commit a31207a

4 files changed

+22
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class RemoveIndexOnNameFromCountiesTable < ActiveRecord::Migration[7.1]
2+
disable_ddl_transaction!
3+
4+
def change
5+
remove_index :counties, :name, algorithm: :concurrently
6+
end
7+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class RemoveIndexOnOrganizationIdFromEventsTable < ActiveRecord::Migration[7.1]
2+
disable_ddl_transaction!
3+
4+
def change
5+
remove_index :events, :organization_id, algorithm: :concurrently
6+
end
7+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class RemoveIndexOnUserIdFromUsersRolesTable < ActiveRecord::Migration[7.1]
2+
disable_ddl_transaction!
3+
4+
def change
5+
remove_index :users_roles, :user_id, algorithm: :concurrently
6+
end
7+
end

db/schema.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.1].define(version: 2024_11_12_184800) do
13+
ActiveRecord::Schema[7.1].define(version: 2024_12_04_133715) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "plpgsql"
1616

@@ -202,7 +202,6 @@
202202
t.datetime "updated_at", null: false
203203
t.enum "category", default: "US_County", null: false, enum_type: "category"
204204
t.index ["name", "region"], name: "index_counties_on_name_and_region", unique: true
205-
t.index ["name"], name: "index_counties_on_name"
206205
t.index ["region"], name: "index_counties_on_region"
207206
end
208207

@@ -298,7 +297,6 @@
298297
t.bigint "user_id"
299298
t.string "group_id"
300299
t.index ["organization_id", "event_time"], name: "index_events_on_organization_id_and_event_time"
301-
t.index ["organization_id"], name: "index_events_on_organization_id"
302300
t.index ["user_id"], name: "index_events_on_user_id"
303301
end
304302

@@ -813,7 +811,6 @@
813811
t.bigint "role_id"
814812
t.index ["role_id"], name: "index_users_roles_on_role_id"
815813
t.index ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id"
816-
t.index ["user_id"], name: "index_users_roles_on_user_id"
817814
end
818815

819816
create_table "vendors", force: :cascade do |t|

0 commit comments

Comments
 (0)