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

1 commit

Author SHA1 Message Date
Rafael Mendonça França
096e25bce7
Don't over protect the MySQL users on insert_all
MySQL don't support conflict target on insert_all so we can't pass the
:unique_by option. But, if you don't check if the index exists MySQL will
successfully inset the data.

If there is a conflict in an index like the primary key the database will
raise an error. We should let the database decide if the data is acceptable
or not.

The test added on this commit exercise a table that has composite primary
keys, but, in order to keep all the Rails behavior working (given Rails
doesn't officially support composite primary keys) we set the primary
key to an auto increment :id column.
2020-11-04 20:26:22 +00:00