This project is archived and is in readonly mode.
Rails 3.0.0 add_index fails silently on invalid index names
-
Tim Connor
This issue also applies to index names automatically generated by rails, eg
add_index :users, [:long_column_name, :other_long_column_name, :third_long_column_name], :unique => truewill appear to work but the index will not be created as the generated name was too long
-
Lake
Thanks for you contribution.
Unfortunately, your patch actually breaks a couple of tests. I recommend that you check out those tests and try to resolve them.
1) Failure: test_add_index_length_limit(MigrationTest) [test/cases/migration_test.rb:130]: Exception raised: <#<ArgumentError: Index name 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' on table 'people' is too long; the limit is 64 characters>>. 2) Failure: test_double_add_index(MigrationTest) [test/cases/migration_test.rb:157]: Exception raised: <#<ArgumentError: Index name 'some_idx' on table 'people' already exists>>. 126 tests, 343 assertions, 2 failures, 0 errors, 0 skips -
Tim Connor
Attached is a second patch which fixes a further issue with remove_index and updates the unit tests.
-
Lake
Great! With your patches combined, the tests pass.
+1
-
Rohit Arondekar
- State changed from new to open
- Assigned user set to José Valim
- Importance changed from to Low
-
Repository
- State changed from open to resolved
(from [37de59eacf8f6478e866309615af7381d41a5a14]) Fix issue with remove_index and add unit test [#5645 Rails 3.0.0 add_index fails silently on invalid index names state:resolved] http://github.com/rails/rails/commit/37de59eacf8f6478e866309615af73...
-
Repository
(from [d3ffea25b2b762ff7af5172e7d501684a8b1ef96]) Fix issue with remove_index and add unit test [#5645 Rails 3.0.0 add_index fails silently on invalid index names state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/d3ffea25b2b762ff7af5172e7d5016...
