提交 c1531ae0 编写于 作者: T Tarmo Tänav 提交者: Jeremy Kemper

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

[#622 state:resolved]
上级 8c91b767
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册