Skip to content

Commit

Permalink
Add transaction check to SQLite2 adapter to fix test_sqlite_add_colum…
Browse files Browse the repository at this point in the history
…n_in_transaction_raises_statement_invalid [rails#1669 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
Mike Gunderloy authored and wycats committed Jan 1, 2009
1 parent ab7c25d commit abfa46e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ def rename_table(name, new_name)
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
Expand Down

0 comments on commit abfa46e

Please sign in to comment.