Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

You must be a member of this account.

This project is archived and is in readonly mode.

add_index

#1377

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.

Reported by Tim Neill · November 14th, 2008 @ 06:35 PM

State: wontfix
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to wontfix

    Not sure what'd be the best way to fix it. You could always submit a patch and help out :) http://guides.rails.info/contrib...

    Thanks !

    March 10th, 2009 @ 12:31 PM

  2. Nick Eskelinen
    Nick Eskelinen

    In this case add_index should probably resort to generating a unique name using MD5 (or something similar).

    January 7th, 2010 @ 07:11 PM

  3. bingbing
  4. af001
    af001

    私の中で、総合評価のとっても低いアバアバクロホリスタークロ銀座店。アバクロは大好きなんですけどね。一昨日の東京駅付近での打ち合わせの後、散歩がてら久々に行ってきました。そしたらビックリ!相変わらアバクロず、踊っているだけの店員さんとかもいましたが、

    May 5th, 2011 @ 03:01 AM