1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fixed the performance regression for primary_keys introduced MySQL 8.0

This commit is contained in:
alpaca-tc 2019-10-13 01:45:27 +09:00
parent c46475ed62
commit 77f4ae0030
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,7 @@
* Fixed the performance regression for `primary_keys` introduced MySQL 8.0.
*Hiroyuki Ishii*
* Add support for `belongs_to` to `has_many` inversing.
*Gannon McGibbon*

View file

@ -433,11 +433,11 @@ module ActiveRecord
query_values(<<~SQL, "SCHEMA")
SELECT column_name
FROM information_schema.key_column_usage
WHERE constraint_name = 'PRIMARY'
FROM information_schema.statistics
WHERE index_name = 'PRIMARY'
AND table_schema = #{scope[:schema]}
AND table_name = #{scope[:name]}
ORDER BY ordinal_position
ORDER BY seq_in_index
SQL
end