summaryrefslogtreecommitdiff
path: root/db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb
blob: 7732728cda8aa7b371aecae0cf87cb2d6288207b (plain)
1
2
3
4
5
6
7
8
9
class AddIndexSpanningUsersAndAddresses < ActiveRecord::Migration[7.0]
  def change
    remove_index(:user_account_addresses, :user_account_id)
    remove_index(:user_account_addresses, :address_id)
    add_index(:user_account_addresses, :user_account_id)
    add_index(:user_account_addresses, :address_id)
    add_index(:user_account_addresses, [:address_id, :user_account_id], unique: true)
  end
end