Skip to content
This repository
Browse code

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

[#622 state:resolved]
  • Loading branch information...
commit 536400bfcf2eafc2f724b2a9dd899cd9bdb26f09 1 parent aa99bd1
Tarmo Tänav authored July 15, 2008 jeremy committed July 15, 2008
3  activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -260,6 +260,9 @@ def change_column(table_name, column_name, type, options = {}) #:nodoc:
260 260
       end
261 261
 
262 262
       def rename_column(table_name, column_name, new_column_name) #:nodoc:
  263
+        unless columns(table_name).detect{|c| c.name == column_name.to_s }
  264
+          raise ActiveRecord::ActiveRecordError, "Missing column #{table_name}.#{column_name}"
  265
+        end
263 266
         alter_table(table_name, :rename => {column_name.to_s => new_column_name.to_s})
264 267
       end
265 268
 

0 notes on commit 536400b

Please sign in to comment.
Something went wrong with that request. Please try again.