public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Add transaction check to SQLite2 adapter to fix 
test_sqlite_add_column_in_transaction_raises_statement_invalid [#1669 
state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
ffmike (author)
Mon Dec 29 18:46:20 -0800 2008
lifo (committer)
Mon Dec 29 19:07:30 -0800 2008
commit  220dff4c3b58b7becb587ee6f2434b2ca720f7c3
tree    ec9ad586b43e872d1abc6016f36958f1384c64b9
parent  558ab327b733717f4a8de3ed62b8dcd62e9ff9c3
...
402
403
404
 
 
 
 
405
406
407
...
402
403
404
405
406
407
408
409
410
411
0
@@ -402,6 +402,10 @@ module ActiveRecord
0
       end
0
 
0
       def add_column(table_name, column_name, type, options = {}) #:nodoc:
0
+        if @connection.respond_to?(:transaction_active?) && @connection.transaction_active?
0
+          raise StatementInvalid, 'Cannot add columns to a SQLite database while inside a transaction'
0
+        end
0
+
0
         alter_table(table_name) do |definition|
0
           definition.column(column_name, type, options)
0
         end

Comments