• R
    SQLite: Fix `copy_table` with composite primary keys · 131cc6ea
    Ryuta Kamizono 提交于
    `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.
    131cc6ea
sqlite3_adapter.rb 18.9 KB