aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-07-10 12:54:56 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-07-10 12:54:56 -0700
commitd7b8f0c05945af83bb1ca446e23a26d8f99db2ca (patch)
tree1680fa60ff7338f8a211987f86c14de466585488 /activerecord/test/cases
parent836016e5070ae96006584c5b7310264b0a27f89a (diff)
parentd735abf401c722a2efb9302f5aa6683b047572f8 (diff)
downloadrails-d7b8f0c05945af83bb1ca446e23a26d8f99db2ca.tar.gz
rails-d7b8f0c05945af83bb1ca446e23a26d8f99db2ca.tar.bz2
rails-d7b8f0c05945af83bb1ca446e23a26d8f99db2ca.zip
Merge pull request #6874 from robbkidd/rename_sequences_too
Rename default sequence when table is renamed? [AR:postgres]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/migration/rename_table_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/rename_table_test.rb b/activerecord/test/cases/migration/rename_table_test.rb
index d5ff2c607f..fbacc4b01a 100644
--- a/activerecord/test/cases/migration/rename_table_test.rb
+++ b/activerecord/test/cases/migration/rename_table_test.rb
@@ -67,6 +67,19 @@ module ActiveRecord
rename_table :octopi, :test_models
end
+
+ def test_rename_table_for_postgresql_should_also_rename_default_sequence
+ skip 'not supported' unless current_adapter?(:PostgreSQLAdapter)
+
+ rename_table :test_models, :octopi
+
+ con = ActiveRecord::Base.connection
+ pk, seq = con.pk_and_sequence_for('octopi')
+
+ assert_equal "octopi_#{pk}_seq", seq
+
+ rename_table :octopi, :test_models
+ end
end
end
end