diff options
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20230325021349_add_unique_indexes_to_user_account_addresses.rb | 8 | ||||
-rw-r--r-- | db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb | 4 |
2 files changed, 4 insertions, 8 deletions
diff --git a/db/migrate/20230325021349_add_unique_indexes_to_user_account_addresses.rb b/db/migrate/20230325021349_add_unique_indexes_to_user_account_addresses.rb deleted file mode 100644 index d8f4d26..0000000 --- a/db/migrate/20230325021349_add_unique_indexes_to_user_account_addresses.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddUniqueIndexesToUserAccountAddresses < 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, unique: true) - add_index(:user_account_addresses, :address_id, unique: true) - end -end diff --git a/db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb b/db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb index 7732728..e1d3062 100644 --- a/db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb +++ b/db/migrate/20230325024534_add_index_spanning_users_and_addresses.rb @@ -1,7 +1,11 @@ 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) |