diff options
author | HombreLaser <sebastian-440@live.com> | 2023-03-24 20:47:26 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-03-24 20:47:26 -0600 |
commit | db54484188304747af8e6c8299f1ccb5b3e1095f (patch) | |
tree | 1ba7b105e9bf8d1e13a581edc5f5a2bc451e42a1 /db/migrate | |
parent | f5f27394fd4c68995949f43edca41d30d30a45aa (diff) |
Añade índice a los dos campos del join table
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb b/db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb new file mode 100644 index 0000000..7732728 --- /dev/null +++ b/db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb @@ -0,0 +1,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 |