blob: e1d3062a43d4bef951fdf3190037d6e3056aaad1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
class AddIndexSpanningUsersAndAddresses < ActiveRecord::Migration[7.0]
def change
remove_foreign_key(:user_account_addresses, :user_accounts)
remove_foreign_key(:user_account_addresses, :addresses)
remove_index(:user_account_addresses, :user_account_id)
remove_index(:user_account_addresses, :address_id)
add_foreign_key(:user_account_addresses, :user_accounts)
add_foreign_key(:user_account_addresses, :addresses)
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
|