These indexes exist, but aren’t needed. Remove them
for faster writes.
rails generate migration remove_unneeded_indexes
And paste
remove_index :account_group_memberships, name: "account_group_memberships_accountId_idx", column: :platform_account_id
remove_index :active_timer, name: "active_timer_staff_id_idx", column: :staff_id
remove_index :active_timer, name: "active_timer_staff_id_idx", column: :staff_id
remove_index :appointment, name: "appointment_public_booking_token_idx", column: :public_booking_token
remove_index :appointment, name: "appointment_public_booking_token_idx", column: :public_booking_token
remove_index :appointment_type, name: "appointment_type_public_booking_token_idx", column: :public_booking_token
remove_index :appointment_type, name: "appointment_type_public_booking_token_idx", column: :public_booking_token
remove_index :appraisal_cycles, name: "appraisal_cycles_departmentid_idx", column: :department_id
remove_index :appraisal_followups, name: "appraisal_followups_appraisalid_idx", column: :appraisal_id
remove_index :appraisals, name: "appraisals_scheduleddate_idx", column: :scheduled_date
remove_index :appraisals, name: "appraisals_staffprofileid_idx", column: :staff_profile_id
remove_index :attendance_exceptions, name: "attendance_exceptions_staffprofileid_idx", column: :staff_profile_id
remove_index :career_path_years, name: "career_path_years_planid_idx", column: :career_path_plan_id
remove_index :cash_reconciliation_rule, name: "idx_cash_recon_rule_org", column: :organization_id
remove_index :combo_product, name: "idx_combo_product_product", column: :product_id
remove_index :customer, name: "idx_customer_org", column: :organization_id
remove_index :customer_pricelist, name: "idx_customer_pricelist_cust", column: :customer_id
remove_index :customer_to_tag, name: "customerToTag_customerId_idx", column: :customer_id
remove_index :cycle_work_items, name: "cycle_work_items_cycleId_idx", column: :cycle_id
remove_index :department_assignments, name: "department_assignments_staffprofileid_idx", column: :staff_profile_id
remove_index :email_report_preference, name: "email_report_preference_userId_idx", column: :user_id
remove_index :expense, name: "idx_expense_org", column: :organization_id
remove_index :expense_category, name: "idx_expense_category_org", column: :organization_id
remove_index :expense_category_link, name: "idx_ecl_expense", column: :expense_id
remove_index :friendships, name: "friendships_requester_idx", column: :requester_id
remove_index :funding_source, name: "idx_funding_source_org", column: :organization_id
remove_index :gift_card, name: "idx_gift_card_code", column: :code
remove_index :invoice, name: "invoice_invoice_number_idx", column: :invoice_number
remove_index :invoice, name: "invoice_invoice_number_idx", column: :invoice_number
remove_index :matter, name: "matter_reference_number_idx", column: :reference_number
remove_index :matter, name: "matter_reference_number_idx", column: :reference_number
remove_index :member, name: "member_userId_idx", column: :user_id
remove_index :notification, name: "notification_userId_idx", column: :user_id
remove_index :notification_preference, name: "notification_preference_user_id_idx", column: :user_id
remove_index :notification_preference, name: "notification_preference_user_id_idx", column: :user_id
remove_index :on_call_schedules, name: "schedules_weekStart_idx", column: :week_start
remove_index :organization, name: "organization_slug_idx", column: :slug
remove_index :passkey, name: "passkey_credentialId_idx", column: :credential_id
remove_index :platform_accounts, name: "platform_accounts_platform_idx", column: :platform
remove_index :portal_document_upload, name: "portal_document_upload_document_id_idx", column: :document_id
remove_index :portal_document_upload, name: "portal_document_upload_document_id_idx", column: :document_id
remove_index :portal_invite, name: "portal_invite_token_idx", column: :token
remove_index :portal_invite, name: "portal_invite_token_idx", column: :token
remove_index :portal_password_reset, name: "portal_password_reset_token_idx", column: :token
remove_index :portal_password_reset, name: "portal_password_reset_token_idx", column: :token
remove_index :portal_session, name: "portal_session_token_idx", column: :token
remove_index :portal_session, name: "portal_session_token_idx", column: :token
remove_index :portal_user, name: "portal_user_client_id_idx", column: :client_id
remove_index :portal_user, name: "portal_user_client_id_idx", column: :client_id
remove_index :portal_user, name: "portal_user_email_idx", column: :email
remove_index :portal_user, name: "portal_user_email_idx", column: :email
remove_index :ppe_issuances, name: "ppe_issuances_staffprofileid_idx", column: :staff_profile_id
remove_index :pricelist_item, name: "idx_pricelist_item_list", column: :pricelist_id
remove_index :push_subscription, name: "push_subscription_userId_idx", column: :user_id
remove_index :receipt_config, name: "idx_receipt_config_org", column: :organization_id
remove_index :report_definition, name: "report_definition_report_code_idx", column: :report_code
remove_index :report_definition, name: "report_definition_report_code_idx", column: :report_code
remove_index :roster_assignments, name: "roster_assignments_scheduleid_idx", column: :schedule_id
remove_index :session, name: "session_token_idx", column: :token
remove_index :staff, name: "staff_user_id_idx", column: :user_id
remove_index :staff, name: "staff_user_id_idx", column: :user_id
remove_index :staff_impersonation_session, name: "staff_impersonation_session_token_idx", column: :token
remove_index :staff_impersonation_session, name: "staff_impersonation_session_token_idx", column: :token
remove_index :staff_invite, name: "staff_invite_token_idx", column: :token
remove_index :staff_invite, name: "staff_invite_token_idx", column: :token
remove_index :staff_profiles, name: "staff_profiles_userId_idx", column: :user_id
remove_index :submission_reactions, name: "submission_reactions_sub_idx", column: :submission_id
remove_index :tag, name: "tag_name_idx", column: :name
remove_index :tag, name: "tag_name_idx", column: :name
remove_index :timesheets, name: "timesheets_staffprofileid_idx", column: :staff_profile_id
remove_index :user_role, name: "idx_user_role_user", column: :user_id
remove_index :work_item_assignees, name: "work_item_assignees_work_item_idx", column: :work_item_id
remove_index :work_item_dependencies, name: "work_item_deps_workItemId_idx", column: :work_item_id
remove_index :work_item_team_allocations, name: "work_item_team_alloc_work_item_idx", column: :work_item_id