提交 23d1b92f 编写于 作者: J Jeremy Kemper

Schema dumper: all connection adapters implement #primary_key, so rely on it exclusively

上级 353b8813
......@@ -105,22 +105,13 @@ def tables(stream)
end
end
def primary_key_for(table)
if @connection.respond_to?(:pk_and_sequence_for)
pk, _ = @connection.pk_and_sequence_for(table)
return pk if pk
end
return @connection.primary_key(table) if @connection.respond_to?(:primary_key)
nil
end
def table(table, stream)
columns = @connection.columns(table)
begin
tbl = StringIO.new
# first dump primary key column
pk = primary_key_for(table)
pk = @connection.primary_key(table)
tbl.print " create_table #{remove_prefix_and_suffix(table).inspect}"
pkcol = columns.detect { |c| c.name == pk }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册