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 [#1669 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
Mike Gunderloy authored and lifo committed Dec 30, 2008
1 parent 558ab32 commit 220dff4
Showing 1 changed file with 4 additions and 0 deletions.
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 220dff4

Please sign in to comment.