This project is archived and is in readonly mode.
Schema dumper ignores custom id column even when :id => false
Reported by Tristan Dunn | February 7th, 2009 @ 11:42 PM | in 2.3.4
Given the following migration:
create_table(:table, :id => false) do |t|
t.string :id, :null => false, :limit => 40
end
the schema dumper would generate the following:
create_table "table", :force => true do |t|
end
This is due to it automatically assuming the ID is the primary key. I got around this problem by checking if the column is also an integer. Not sure if it's the best way, but it just drove me crazy for a good while since my tests would fail, but everything worked fine in the console. I have attached my simple patch.
Comments and changes to this ticket
-
dust March 3rd, 2009 @ 03:29 PM
+1
I spent a nice chunk of yesterday tracking this issue down on my system, and this patch (along with re-dumping the schema, obviously) fixes the issue for me.
-
CancelProfileIsBroken August 5th, 2009 @ 02:21 PM
- Tag changed from primary_key, schema to bugmash, primary_key, schema
-
Tristan Dunn August 8th, 2009 @ 11:35 PM
New patch to simply not default the primary key to ID in the schema dumper. If you don't define it then the connection should find it.
-
Tristan Dunn August 8th, 2009 @ 11:48 PM
Seems to be some confusion on which branch I should be working on so I made one on master and 2-3-stable.
-
Dan Croak August 8th, 2009 @ 11:56 PM
+1 verified 2-3-stable patch applies clean and tests run green. Implementation looks good to me.
-
Jeremy Kemper August 9th, 2009 @ 03:33 AM
- Assigned user set to Jeremy Kemper
- Tag changed from bugmash, primary_key, schema to primary_key, schema
- State changed from new to committed
- Milestone changed from 2.x to 2.3.4
2-3-stable: 9aa9bad024253a7ab2adee63df8185dc876393f9
master: 791cccaedab9c3e975b00135db76047ad4435611
-
Repository August 9th, 2009 @ 05:32 AM
(from [9aa9bad024253a7ab2adee63df8185dc876393f9]) Don't define a default primary key in the schema dumper.
[#1908 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/9aa9bad024253a7ab2adee63df8185... -
Repository August 9th, 2009 @ 05:32 AM
(from [791cccaedab9c3e975b00135db76047ad4435611]) Don't define a default primary key in the schema dumper.
[#1908 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/791cccaedab9c3e975b00135db7604...
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>
People watching this ticket
Attachments
Tags
Referenced by
- 1908 Schema dumper ignores custom id column even when :id => false [#1908 state:committed]
- 1908 Schema dumper ignores custom id column even when :id => false [#1908 state:committed]
- 4099 ignore :id => false in migrations Same as https://rails.lighthouseapp.com/projects/8994/ti...