Forum: Ruby on Rails rake:db:prepare Mysql::Error: #42000BLOB/TEXT column ' used in key specification without a length

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Will (Guest)
on 2009-03-10 00:43
(Received via mailing list)
I have a test environment running rails 1.2.3.  I am just starting to
introduce testing into this project.
When I run a rake db:prepare.  I see this message "Mysql::Error:
#42000BLOB/TEXT column 'short_description' used in key specification
without a key length:  CREATE INDEX 'short_description' on cached_cars
('short_description')

The initial migration from the product displays this:
[]#rake db:test:prepare --trace

(in /var/www/matrix-1.7.18)
** Invoke db:test:prepare (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:test:prepare
** Invoke db:test:clone (first_time)
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:clone
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
rake aborted!
Mysql::Error: #42000BLOB/TEXT column 'short_description' used in key
specification without a key length: CREATE  INDEX `short_description`
ON cached_scrs (`short_description`)
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract_adapter.rb:128:in `log'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/mysql_adapter.rb:243:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/schema_statements.rb:197:in
`add_index'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/migration.rb:275:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/migration.rb:275:in `method_missing'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/migration.rb:259:in `say_with_time'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/migration.rb:259:in `say_with_time'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/migration.rb:273:in `method_missing'
./db/schema.rb:154
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/schema.rb:43:in `instance_eval'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/schema.rb:43:in `define'
./db/schema.rb:5
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:488:in `load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:488:in `load'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:342:in `new_constants_in'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:488:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:
31
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
`invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
`invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in
`invoke'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:
76
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
`invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
`invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in
`invoke'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:
153
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in
`execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
`invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
`invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in
`invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in
`invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
`standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in
`top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
`standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
/usr/local/bin/rake:16:in `load'
/usr/local/bin/rake:16

Here is my environment.
rake 0.8.4
ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-linux]
gem 0.9.4
rails 1.2.3

Any ideas???
bill walton (Guest)
on 2009-03-10 00:52
(Received via mailing list)
Hi Will,

On Mon, 2009-03-09 at 15:42 -0700, Will wrote:
> When I run a rake db:prepare.  I see this message "Mysql::Error:
> #42000BLOB/TEXT column 'short_description' used in key specification
> without a key length:  CREATE INDEX 'short_description' on cached_cars
> ('short_description')

MySQL requires an indexed field have a length and blobs don't support
it.  I can't recall right off the top of my head what the max length is,
but we fought this same issue at my last on-site gig.

Good luck,
Bill
Will (Guest)
on 2009-03-10 21:38
(Received via mailing list)
I was able to create another migration to drop that database and
create it again with no indexes on these text fields.  Once I did this
all appears to be well.

Thanks
Will
This topic is locked and can not be replied to.