Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #2643 (closed enhancement: wontfix)

Opened 3 years ago

Last modified 1 year ago

ruby schema generator generates int(11) when it should generate bigint(20) for 'ID's in MySQL

Reported by: Sam Assigned to: David
Priority: low Milestone:
Component: ActiveRecord Version: 0.14.1
Severity: normal Keywords:
Cc:

Description

seems the new schema.rb/'rake db_schema_import' system doesn't generate wide enough ID's by default for Mysql.

Current:

'id' int(11)

Desired:

'id' unsigned int(20) (aka unsigned bigint)

Change History

10/29/05 13:42:52 changed by david

  • priority changed from high to low.
  • type changed from defect to enhancement.

Wide enough for what? "100 Billion Should Be Enough For Everyone" :)

10/29/05 14:21:19 changed by minam

FYI, the width has nothing to do with the precision. It is only used, according to the mysql manual, "left-pad the display of values having a width less than the width specified for the column". Furthermore, "The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column."

It's the actual column type that constrains the range of values. "int" (unsigned) has a range of 0 to 4,294,967,295. "bigint" has a range of 0 to 18446744073709551615. It might be desirable to allow the type of the "id" column to be changed (from "int" to "bigint", for example), but really... 4 billion is quite a bit. I can imagine there are apps that need a wider range, so I can see where a patch allowing the column type to be more flexibly specified would be desirable in some instances. If someone were to submit such a patch, it would probably be accepted.

10/31/05 12:03:31 changed by Sam

  • summary changed from ruby schema generator generates int(11) when it should generate int(20) for 'ID's in MySQL to ruby schema generator generates int(11) when it should generate bigint(20) for 'ID's in MySQL.

My goof. I was more concerned about 'int' vs. 'bigint', and the lack of unsignedness.

05/23/07 19:06:20 changed by josh

  • status changed from new to closed.
  • resolution set to wontfix.