提交 c1003d99 编写于 作者: A Aaron Patterson

ask column if it is a pk

上级 2394d28a
......@@ -24,6 +24,10 @@ def sql_type
base.type_to_sql(type.to_sym, limit, precision, scale)
end
def primary_key?
type == :primary_key
end
def to_sql
column_sql = "#{base.quote_column_name(name)} #{sql_type}"
column_options = {}
......@@ -299,7 +303,7 @@ def new_column_definition(base, name, type)
end
def primary_key_column_name
primary_key_column = columns.detect { |c| c.type == :primary_key }
primary_key_column = columns.detect { |c| c.primary_key? }
primary_key_column && primary_key_column.name
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册