This patch: http://github.com/rails/rails/commit/a37546517dad9f6d9a7de6e1dba4d960909d71e8
means that test database structure is not created properly (integer columns get recreated as bigints). If you’re also using Foreign Key Migrations, your test database simply won’t get built. It’s too bad the Rails core team didn’t more carefully consider the implications of this patch. Anyway, we can correct the mistake with the following patch:
===================================================================
--- vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb (revision 62)
+++ vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb (working copy)
@@ -470,9 +470,9 @@
case limit
when 0..3
"smallint(#{limit})"
- when 4..8
+ when 4..11
"int(#{limit})"
- when 9..20
+ when 12..20
"bigint(#{limit})"
else
'int(11)'
June 10, 2008 at 4:45 pm |
Did you try posting a comment on the URL for the commit? I’m curious how that works on GitHub and whether people read them (seems like a reasonably low-friction way to do code reviews).
June 16, 2008 at 8:55 am |
I just posted a comment, so we shall see…
June 24, 2008 at 1:06 pm |
I found this to be useful….I’ll re-blogged it here: http://blog.smartlogicsolutions.com/2008/06/24/rails-21-broke-my-mysql-foreign-keys/. Thanks Tim!
June 25, 2008 at 2:44 am |
[...] Mirko Froehlich suggests monkey patching this function. Timothy Jones blogged about it. [...]