diff options
author | Paul Sadauskas <psadauskas@gmail.com> | 2012-01-24 14:22:24 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-02-08 13:34:04 +0100 |
commit | 0a75336c89a517bf2328a6e5f87319b9f2457252 (patch) | |
tree | c4af4c1c62a1cbf5ef70b3b843d9046976838024 /activerecord/test/cases/column_definition_test.rb | |
parent | 77b4edce1544f105cc7764249becc1e998b88fc2 (diff) | |
download | rails-0a75336c89a517bf2328a6e5f87319b9f2457252.tar.gz rails-0a75336c89a517bf2328a6e5f87319b9f2457252.tar.bz2 rails-0a75336c89a517bf2328a6e5f87319b9f2457252.zip |
Handle nil in add_index :length option in MySQL
Our schema.rb is being generated with an `add_index` line similar to this:
add_index "foo", ["foo", "bar"], :name => "xxx", :length => {"foo"=>8, "bar=>nil}
This is the same as it was on Rails 3.1.3, however, now when that
schema.rb is evaluated, its generating bad SQL in MySQL:
Mysql::Error: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax
to use near '))' at line 1: CREATE UNIQUE INDEX
`xxx` ON `foo` (`foo`(8), `bar`())
This commit adds a check for nil on the length attribute to prevent the
empty parens from being output.
Conflicts:
activerecord/test/cases/migration/index_test.rb
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/cases/column_definition_test.rb')
0 files changed, 0 insertions, 0 deletions