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)'
Filed under: rails | 4 Comments
Search
-
You are currently browsing the Timothy N. Jones weblog archives.
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).
I just posted a comment, so we shall see…
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!