Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Rails Migrations, what does the number specified for :limit on an integer represent?

Tags:

In Rails Migrations, what does the number specified for the :limit parameter on an integer represent? Is it the number of bytes or the number of digits?

i.e. If I were to specify the following:

t.integer :coefficient, :limit => 2

Does that mean the SQL database will reserve two bytes for each integer, or that each integer can not have more than two digits? I'm assuming it means bytes, but I'm not positive.

Thanks!

like image 474
JP Richardson Avatar asked Dec 09 '08 21:12

JP Richardson


1 Answers

According to the documentation, it's the number of characters for :string and :text columns and the number of bytes for :binary and :integer columns.

like image 151
John Topley Avatar answered Oct 27 '22 23:10

John Topley