mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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>
This commit is contained in:
parent
558ab327b7
commit
220dff4c3b
1 changed files with 4 additions and 0 deletions
|
@ -402,6 +402,10 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def add_column(table_name, column_name, type, options = {}) #:nodoc:
|
||||
if @connection.respond_to?(:transaction_active?) && @connection.transaction_active?
|
||||
raise StatementInvalid, 'Cannot add columns to a SQLite database while inside a transaction'
|
||||
end
|
||||
|
||||
alter_table(table_name) do |definition|
|
||||
definition.column(column_name, type, options)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue