This project is archived and is in readonly mode.
Add support for index length in MySQL adapter and schema dumper
Reported by Jonathan Weiss | August 14th, 2008 @ 09:07 AM | in 2.x
Add support for index length in MySQL adapter and schema dumper.
Using this patch you can now define a length for you indices:
add_index(:people, :col_name, :length => 5) add_index(:people, [:col_name, :other_col], :length => {:col_name => 5, :other_col => 1})
This will result in the following SQL:
CREATE INDEX index_people_on_col_name
ON people
(col_name
(5))
CREATE INDEX index_people_on_col_name
ON people
(col_name
(5), other_col
(1))
The schema dumper will honor the index length so that schema.rb will be correct and keep track of index length.
See http://github.com/jweiss/rails/c...
http://github.com/jweiss/rails/c...
http://github.com/jweiss/rails/c...
http://github.com/jweiss/rails/c...
Or the attached patch.
Provided by Christoph Bünte (info@christophbuente.de), Enno Brehm (enno.brehm@gmail.com) Jonathan Weiss (jw@innerewut.de)
Comments and changes to this ticket
-
Jonathan Weiss August 14th, 2008 @ 09:07 AM
- no changes were found...
-
Pratik October 7th, 2008 @ 03:56 PM
- Assigned user set to Pratik
- State changed from new to wontfix
I think this is a better fit for a plugin. I asked around and no one really ever needed to use this feature. Having said that, if you want Rails to provide any hooks for pluginizing this, patches will be most welcome.
If you find people who need this feature, please have them post +1 here and we can re-evaluate the patch.
Thanks.
-
Ricky November 3rd, 2008 @ 07:25 AM
+1 on this. This sort of thing seems to be required whenever you create an index on a blob-like field (text/binary/etc).
-
dkindlund March 2nd, 2009 @ 10:06 PM
- Have you seen the plugin-version of this? http://dev.rubyonrails.org/ticke...
Also, even though the plugin works, it fails to write the correct length information to the db/schema.rb file. So, when you run something like "rake tests:unit", then the corresponding db/schema.rb file loads but fails on the malformed index (i.e., "no length specified").
So, if you use that plugin as a basis, is there any way to add the "db/schema.rb" creation logic to the plugin?
-
...Paul September 6th, 2009 @ 09:26 PM
You can uncomment this line from config/environment.rb
config.active_record.schema_format = :sql
Then rake tests will clone_structure rather than just clone. Reference comment on Bug #74.
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>
Attachments
Referenced by
- 1852 Patch to add index length support I'm posting +2 since it solve two problems, but you shoul...