lib/sequel/adapters/shared/mysql.rb in sequel-4.17.0 vs lib/sequel/adapters/shared/mysql.rb in sequel-4.18.0
- old
+ new
@@ -458,13 +458,15 @@
m = output_identifier_meth(opts[:dataset])
im = input_identifier_meth(opts[:dataset])
table = SQL::Identifier.new(im.call(table_name))
table = SQL::QualifiedIdentifier.new(im.call(opts[:schema]), table) if opts[:schema]
metadata_dataset.with_sql("DESCRIBE ?", table).map do |row|
- row[:auto_increment] = true if row.delete(:Extra).to_s =~ /auto_increment/io
+ extra = row.delete(:Extra)
+ if row[:primary_key] = row.delete(:Key) == 'PRI'
+ row[:auto_increment] = !!(extra.to_s =~ /auto_increment/io)
+ end
row[:allow_null] = row.delete(:Null) == 'YES'
row[:default] = row.delete(:Default)
- row[:primary_key] = row.delete(:Key) == 'PRI'
row[:db_type] = row.delete(:Type)
row[:type] = schema_column_type(row[:db_type])
[m.call(row.delete(:Field)), row]
end
end