This project is archived and is in readonly mode.
Make SchemaDumper dump primary keys not named 'id' correctly in SQLite3
Reported by Aslak Hellesøy | October 2nd, 2008 @ 07:14 AM | in 3.x
Consider this schema:
create_table :pets, :primary_key => :pet_id ,:force => true do |t|
t.string :name
t.integer :owner_id, :integer
end
This gets incorrectly dumped like the following when using SQLite3 (:pet_id is no longer a pk):
create_table "pets", :id => false, :force => true do |t|
t.integer "pet_id", :null => false
t.string "name"
t.integer "owner_id"
t.integer "integer"
end
This patch fixes this so the output is correct:
create_table "pets", :primary_key => "pet_id", :force => true do |t|
t.string "name"
t.integer "owner_id"
t.integer "integer"
end
We ran into this bug when developing against a legacy database schema. We wanted the test and development environments to run against SQLite3 and production against SQL Server (yikes).
The original fix was found in the old Trac - Ticket 6095
The fix can be cherry-picked from Git in this commit
Comments and changes to this ticket
-
Matt Scilipoti January 14th, 2009 @ 09:31 PM
The fix listed in the referenced fork on Git worked for me. Still needed in Rails 2.2.2.
-
Pratik March 10th, 2009 @ 05:34 PM
- Assigned user set to Pratik
- State changed from new to incomplete
- I get failing test on MySQL after applying the patch.
- Could you please upload a patch using git-format-patch ?
Thanks.
-
Santiago Pastorino February 2nd, 2011 @ 05:04 PM
- State changed from incomplete to open
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 05:04 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>