Merge pull request 'Fix duplicate row index on upsert statement' (#213) from fix-upsert-index into main
All checks were successful
Check usage of free licenses / check-licenses (push) Successful in 51s
Run unit tests / unit_tests (push) Successful in 1m48s
Build Nginx-based docker image / build-static-assets (push) Successful in 12m11s

Reviewed-on: #213
This commit is contained in:
bustikiller 2025-01-14 22:11:43 +00:00
commit d6fd72a45c

View File

@ -26,7 +26,7 @@ class AffinitiesController < ApplicationController
}
end
GroupAffinity.upsert_all(affinities)
GroupAffinity.upsert_all(affinities, unique_by: :uindex_group_pair)
render json: {}, status: :ok
rescue ActiveRecord::InvalidForeignKey
@ -50,7 +50,7 @@ class AffinitiesController < ApplicationController
}
end
GroupAffinity.upsert_all(affinities)
GroupAffinity.upsert_all(affinities, unique_by: :uindex_group_pair)
render json: {}, status: :ok
end