Skip to content

Commit

Permalink
SQLite: rename_column raises if the column doesn't exist.
Browse files Browse the repository at this point in the history
[#622 state:resolved]
  • Loading branch information
tarmo authored and jeremy committed Jul 15, 2008
1 parent 8c91b76 commit c1531ae
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -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

Expand Down

0 comments on commit c1531ae

Please sign in to comment.