diff options
author | Sean Scally <sean.scally@gmail.com> | 2012-05-14 14:47:25 -0500 |
---|---|---|
committer | Sean Scally <sean.scally@gmail.com> | 2012-05-14 14:47:25 -0500 |
commit | 3188f81199bdfa0d1660c4e2664d822544f9e04e (patch) | |
tree | 00d8ee067654af4c45e736330aa56ff95c3f9d25 /activerecord/test | |
parent | c5bcb0de6b5a805a3c9556684715b5cd463dc0c8 (diff) | |
download | rails-3188f81199bdfa0d1660c4e2664d822544f9e04e.tar.gz rails-3188f81199bdfa0d1660c4e2664d822544f9e04e.tar.bz2 rails-3188f81199bdfa0d1660c4e2664d822544f9e04e.zip |
Set the primary key during #copy_table if necessary. Fixes [#2312]
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/sqlite3/copy_table_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb b/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb index 575b4806c1..7eef4ace81 100644 --- a/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb +++ b/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb @@ -57,6 +57,14 @@ class CopyTableTest < ActiveRecord::TestCase end end + def test_copy_table_with_unconventional_primary_key + test_copy_table('owners', 'owners_unconventional') do |from, to, options| + original_pk = @connection.primary_key('owners') + copied_pk = @connection.primary_key('owners_unconventional') + assert_equal original_pk, copied_pk + end + end + protected def copy_table(from, to, options = {}) @connection.copy_table(from, to, {:temporary => true}.merge(options)) |