Once and for all: Rails migrations integer :limit option
I literally always have to look up the meaning of :limit in migrations when it comes to integer values. Here’s an overview. Now let’s memorise it (oh, this works for MySQL, other databases may work differently):
|:limit||Numeric Type||Column Size||Max value|
|nil, 4, 11||int(11)||4 byte||2147483647|
Note: by default MySQL uses signed integers and Rails has no way (that I know of) to change this behaviour. Subsequently, the max. values noted are for signed integers.
Hey! I'm a software engineer building rock solid back-end systems using Ruby, Ruby on Rails and Golang. In my free time I like to play the piano and experiment with electronics.