If a table has a primary key which has a name other than 'id', then dumping the schema ruby file produced by using ActiveRecord::SchemaDumper.dump (as rake db:schema:dump uses to produce db/schema.rb) does not define ANY primary key for the table.
SchemaDumper has a mechanism to handle this, and it's used by other adapters such as Oracle and Postgresql. The mysql adapter doesn't implement the pk_and_sequence_for method which is needed to find such primary keys.
This can cause havoc when you do something like rake db:test:prepare I've found that most of my ActiveRecord tests LIKE to have primary keys defined in the database. <G>
The attached patch fixes this along with a test.