diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-10-23 17:35:10 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-23 17:35:10 +0900 |
commit | 6fad20700127d501ccd58f4d346b6c2be5348f08 (patch) | |
tree | 8066ef3de78eb98902433305893b0722f07d8f20 /activerecord/lib/active_record/connection_adapters | |
parent | 759b3af0c6fc9fb502031a05b281736602ff8e5f (diff) | |
parent | 26369bbebf86570fad64032a7121a476019eb7f3 (diff) | |
download | rails-6fad20700127d501ccd58f4d346b6c2be5348f08.tar.gz rails-6fad20700127d501ccd58f4d346b6c2be5348f08.tar.bz2 rails-6fad20700127d501ccd58f4d346b6c2be5348f08.zip |
Merge pull request #34292 from yahonda/mysql8013
MySQL 8.0.13 raises `ER_NO_REFERENCED_ROW` and `ER_ROW_IS_REFERENCED`
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index cb5eeb64dd..0f73641369 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -624,6 +624,8 @@ module ActiveRecord # See https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html ER_DUP_ENTRY = 1062 ER_NOT_NULL_VIOLATION = 1048 + ER_NO_REFERENCED_ROW = 1216 + ER_ROW_IS_REFERENCED = 1217 ER_DO_NOT_HAVE_DEFAULT = 1364 ER_ROW_IS_REFERENCED_2 = 1451 ER_NO_REFERENCED_ROW_2 = 1452 @@ -640,7 +642,7 @@ module ActiveRecord case error_number(exception) when ER_DUP_ENTRY RecordNotUnique.new(message) - when ER_ROW_IS_REFERENCED_2, ER_NO_REFERENCED_ROW_2 + when ER_NO_REFERENCED_ROW, ER_ROW_IS_REFERENCED, ER_ROW_IS_REFERENCED_2, ER_NO_REFERENCED_ROW_2 InvalidForeignKey.new(message) when ER_CANNOT_ADD_FOREIGN mismatched_foreign_key(message) |