This project is archived and is in readonly mode.

#1377 ✓wontfix
Tim Neill

add_index

Reported by Tim Neill | November 14th, 2008 @ 06:35 PM | in 2.x

Guys -

There is a very simple problem with the add_index command & mysql. It is not validating whether index names are too long and working around them.

e.g.:


# Comp Category Hierarchy Table
create_table :comp_category_hierarchies, :id => false do |t|
  t.column :comp_category_id, :integer, :null => false
  t.column :comp_subcategory_id, :integer, :null => false
end
add_index(:comp_category_hierarchies, [:comp_category_id, :comp_subcategory_id], :unique => true)

Generates the following error:


Mysql::Error: Identifier name 'index_comp_category_hierarchies_on_comp_category_id_and_comp_subcategory_id' is too long: CREATE UNIQUE INDEX `index_comp_category_hierarchies_on_comp_category_id_and_comp_subcategory_id` ON `comp_category_hierarchies` (`comp_category_id`, `comp_subcategory_id`)

Just thought I would let you know.

Thanks for all the hard work.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages