Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding index fails #4

Open
marr opened this issue Nov 10, 2015 · 4 comments
Open

adding index fails #4

marr opened this issue Nov 10, 2015 · 4 comments

Comments

@marr
Copy link

marr commented Nov 10, 2015

After following books instructions on how to build the links index:

$ bundle exec rake db:migrate
== 20151110014616 AddIndexToLinks: migrating ==================================
-- add_index(:links, :cl_sortkey)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: BLOB/TEXT column 'cl_sortkey' used in key specification without a key length: CREATE  INDEX `index_links_on_cl_sortkey`  ON `links` (`cl_sortkey`) /Users/dmarr/wikicat/db/migrate/20151110014616_add_index_to_links.rb:3:in `change'
ActiveRecord::StatementInvalid: Mysql2::Error: BLOB/TEXT column 'cl_sortkey' used in key specification without a key length: CREATE  INDEX `index_links_on_cl_sortkey`  ON `links` (`cl_sortkey`)
/Users/dmarr/wikicat/db/migrate/20151110014616_add_index_to_links.rb:3:in `change'
Mysql2::Error: BLOB/TEXT column 'cl_sortkey' used in key specification without a key length
/Users/dmarr/wikicat/db/migrate/20151110014616_add_index_to_links.rb:3:in `change'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)`
``
@marr
Copy link
Author

marr commented Nov 10, 2015

Migrating over to postgresql did get past that..

@hiromipaw
Copy link
Owner

Hi @marr,
Thanks for reaching out. Are you using the dump from dropbox or a new one?

@crose1000
Copy link

I have an identical issue. I think this link explains it.
http://stackoverflow.com/questions/1827063/mysql-error-key-specification-without-a-key-length
I am using this to learn rails, so I do not yet understand how to fix or workaround. I tried
add_index :links, :cl_sortkey(255)
in 20140908145510_add_index_to_links, and this is not syntactically correct.
Any suggestions?

@crose1000
Copy link

add_index :links, :cl_sortkey, :length => { :cl_sortkey => 255 }

worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants