diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-12-08 10:49:25 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-12-08 11:05:33 +0900 |
commit | 131cc6eab64eeae6c7f508dca4176183144cf3a6 (patch) | |
tree | 5513316e752360c6d49fcf566ce1d3a8828ffde4 /railties/lib/rails/code_statistics.rb | |
parent | e88e6cea2113ce3e54410cbd8c2da92b86f83d2b (diff) | |
download | rails-131cc6eab64eeae6c7f508dca4176183144cf3a6.tar.gz rails-131cc6eab64eeae6c7f508dca4176183144cf3a6.tar.bz2 rails-131cc6eab64eeae6c7f508dca4176183144cf3a6.zip |
SQLite: Fix `copy_table` with composite primary keys
`connection.primary_key` also return composite primary keys, so
`from_primary_key_column` may not be found even if `from_primary_key` is
presented.
```
% ARCONN=sqlite3 be ruby -w -Itest
test/cases/adapters/sqlite3/sqlite3_adapter_test.rb -n
test_copy_table_with_composite_primary_keys
Using sqlite3
Run options: -n test_copy_table_with_composite_primary_keys --seed 19041
# Running:
E
Error:
ActiveRecord::ConnectionAdapters::SQLite3AdapterTest#test_copy_table_with_composite_primary_keys:
NoMethodError: undefined method `type' for nil:NilClass
/path/to/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:411:in
`block in copy_table'
```
This change fixes `copy_table` to do not lose composite primary keys.
Diffstat (limited to 'railties/lib/rails/code_statistics.rb')
0 files changed, 0 insertions, 0 deletions