# Rake db:schema:dump doesn't produce composite primary key instructions

**URL:** <https://www.ruby-forum.com/t/rake-dbdump-doesnt-produce-composite-primary-key-instructions/168800>\
**Category:** Rails\
**Created:** [May 26, 2009, 7:42am UTC](https://www.ruby-forum.com/t/rake-dbdump-doesnt-produce-composite-primary-key-instructions/168800 "2009-05-26T07:42:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![timhunter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/71e660/32.png) [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Post date:** [May 26, 2009, 7:42am UTC](https://www.ruby-forum.com/t/rake-dbdump-doesnt-produce-composite-primary-key-instructions/168800/1 "2009-05-26T07:42:56Z")

</div>

Hey there,

I’ve adjusted some of my many to many join tables recently to use a  
composite primary key based on the id’s in the two columns - instead  
of using a surrogate key.

I just did a db:schema:dump, and it looks something like this:

create\_table “class\_members”, :id =\> false, :force =\> true do |t|  
t.integer “user\_id”, :default =\> 0, :null =\> false  
t.integer “class\_id”, :default =\> 0, :null =\> false  
end

So it knows to exclude the id, but it has no information on the  
primary key.

Is this a bug, or is there a good reason for it?

Cheers,

Tim.
