diff options
author | Robb Kidd <robb@thekidds.org> | 2012-07-10 21:33:24 -0400 |
---|---|---|
committer | Robb Kidd <robb@thekidds.org> | 2012-07-10 21:37:38 -0400 |
commit | 8d3eafe7906f6d6cf22f7d1ff038c887a32d9a6b (patch) | |
tree | efe70a001cbb118000d37c2085a954994355e7d9 /activerecord/test/cases | |
parent | 3b1de4a29cb8dd463c2fe12f981ca56559f4e5bb (diff) | |
download | rails-8d3eafe7906f6d6cf22f7d1ff038c887a32d9a6b.tar.gz rails-8d3eafe7906f6d6cf22f7d1ff038c887a32d9a6b.tar.bz2 rails-8d3eafe7906f6d6cf22f7d1ff038c887a32d9a6b.zip |
Update psql adapter to rename a default pkey sequence during rename_table.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index bedae76e28..fb5eb2633b 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -949,6 +949,26 @@ if ActiveRecord::Base.connection.supports_migrations? end end + if current_adapter?(:PostgreSQLAdapter) + def test_rename_table_for_postgresql_should_also_rename_default_sequence + begin + ActiveRecord::Base.connection.create_table :octopuses do |t| + t.column :url, :string + end + ActiveRecord::Base.connection.rename_table :octopuses, :octopi + + pk, seq = ActiveRecord::Base.connection.pk_and_sequence_for('octopi') + + assert_equal "octopi_#{pk}_seq", seq + + ensure + ActiveRecord::Base.connection.drop_table :octopuses rescue nil + ActiveRecord::Base.connection.drop_table :octopi rescue nil + end + end + end + + def test_change_column_nullability Person.delete_all Person.connection.add_column "people", "funny", :boolean |