Sha256: ee9fb41933459e6439646f57bcb664e47594d8b82760e67cfb6668b851b4ccfb
Contents?: true
Size: 588 Bytes
Versions: 19
Compression:
Stored size: 588 Bytes
Contents
module ActiveRecord module ConnectionAdapters class MysqlAdapter < AbstractAdapter alias_method :orig_pk_and_sequence_for, :pk_and_sequence_for # mysql accepts varchar as a primary key but most others do not. # only say that a field is a primary key if mysql says so # and the field is a kind of integer def pk_and_sequence_for(table) keys = [] execute("describe #{quote_table_name(table)}").each_hash do |h| keys << h["Field"] if h["Key"] == "PRI" and !(h["Type"] =~ /int/).nil? end keys.length == 1 ? [keys.first, nil] : nil end end end end
Version data entries
19 entries across 19 versions & 3 rubygems