aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorTarmo Tänav <tarmo@itech.ee>2008-08-22 23:53:31 +0300
committerJeremy Kemper <jeremy@bitsweat.net>2008-08-22 14:46:25 -0700
commit707ee0e2695e85186d59aa407f09691ebfcc3125 (patch)
tree4357234d7cdb191d267e400ea217642124e06cae /activerecord/test/cases
parent9dac5547ad65e82a6fbb6a6243ab5c95d9c44db0 (diff)
downloadrails-707ee0e2695e85186d59aa407f09691ebfcc3125.tar.gz
rails-707ee0e2695e85186d59aa407f09691ebfcc3125.tar.bz2
rails-707ee0e2695e85186d59aa407f09691ebfcc3125.zip
Made migrations transactional for PostgreSQL [#834 state:resolved]
Patch originally from http://dev.rubyonrails.org/ticket/5470
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/migration_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index b3e6b29165..9639588ef2 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -937,6 +937,21 @@ if ActiveRecord::Base.connection.supports_migrations?
assert_equal(0, ActiveRecord::Migrator.current_version)
end
+ if current_adapter?(:PostgreSQLAdapter)
+ def test_migrator_one_up_with_exception_and_rollback
+ assert !Person.column_methods_hash.include?(:last_name)
+
+ e = assert_raises(StandardError) do
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/broken", 100)
+ end
+
+ assert_equal "An error has occurred, this and all later migrations canceled:\n\nSomething broke", e.message
+
+ Person.reset_column_information
+ assert !Person.column_methods_hash.include?(:last_name)
+ end
+ end
+
def test_finds_migrations
migrations = ActiveRecord::Migrator.new(:up, MIGRATIONS_ROOT + "/valid").migrations
[['1', 'people_have_last_names'],