I was thrilled to recently discover migrations, as that framework
addresses a common problem in an elegant way. I have, however, gotten
tripped up a bit as I’ve worked with them.
The first problem I encountered was that, though I was using a BigInt
data type in a field in my dev database, my unit tests were failing
because when I copied the schema from the dev to the testing DB, it was
copied as a plain int. This caused the large values in my unit tests to
fail. I understand why the Migration framework doesn’t support this,
since not all database engines might support BigInts, but it did catch
me by surprise.
So, my next idea was to convert the field to text. While I only need 13
characters in this field, using the change_column command with a :string
type resulted in a varchar with a length of 255. I tried adding a :size
=> 13 option (and a :length => 13 option), but it didn’t make any
difference. So, my actual question: is there any way to specify the
length of a field, or does one just take whatever the framework gives
you by default?
Thanks in advance for any info!