Permalink
Browse files

SQLite: rename_column raises if the column doesn't exist.

[#622 state:resolved]
  • Loading branch information...
1 parent 8c91b76 commit c1531ae00dbd3ac804bce02733e050ec43400607 @tarmo tarmo committed with jeremy Jul 15, 2008
Showing with 3 additions and 0 deletions.
  1. +3 −0 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
View
3 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -260,6 +260,9 @@ def change_column(table_name, column_name, type, options = {}) #:nodoc:
end
def rename_column(table_name, column_name, new_column_name) #:nodoc:
+ unless columns(table_name).detect{|c| c.name == column_name.to_s }
+ raise ActiveRecord::ActiveRecordError, "Missing column #{table_name}.#{column_name}"
+ end
alter_table(table_name, :rename => {column_name.to_s => new_column_name.to_s})
end

0 comments on commit c1531ae

Please sign in to comment.