As far as I can tell, all ActiveRecord int columns are set with display width of 11.
Example below modified from Rails Guides:
CREATE TABLE products (
id int(11) NOT NULL auto_increment,
val int(11) NOT NULL,
name varchar(255),
PRIMARY KEY (id)
);
This makes sense with the MySQL default for signed int, since it requires 11 characters to display the min value and the negative sign. See this SO question.
Currently, the gem modifies the default behavior and all int value columns are created with a display width of 10. This causes slight differences in the structure.sql files created by ActiveRecord. In the spec migrations you refer to the int(10) being the default ActiveRecord primary_key, but that does not appear to be true.
Does it make more sense to respect the default ActiveRecord behavior and for signed int columns set the display width to 11 and for unsigned int columns set it to 10?
CREATE TABLE products (
id int(10) unsigned NOT NULL auto_increment,
val int(11) NOT NULL,
n int(10) unsigned NOT NULL,
name varchar(255),
PRIMARY KEY (id)
);
As far as I can tell, all ActiveRecord
intcolumns are set with display width of 11.Example below modified from Rails Guides:
This makes sense with the MySQL default for signed
int, since it requires 11 characters to display the min value and the negative sign. See this SO question.Currently, the gem modifies the default behavior and all
intvalue columns are created with a display width of 10. This causes slight differences in thestructure.sqlfiles created by ActiveRecord. In the spec migrations you refer to theint(10)being the default ActiveRecord primary_key, but that does not appear to be true.Does it make more sense to respect the default ActiveRecord behavior and for signed
intcolumns set the display width to 11 and for unsignedintcolumns set it to 10?