Open paladini opened 8 years ago
I was trying to run DBHero on a MySQL database and have some issues related to index.
[ec2-user@ip-172-31-26-217 dbhero]$ rake db:migrate == 20160616203934 CreateDbheroDataclips: migrating ============================ -- create_table(:dbhero_dataclips) -> 0.0285s -- add_index(:dbhero_dataclips, :token, {:unique=>true}) rake aborted! StandardError: An error has occurred, all later migrations canceled: Mysql2::Error: BLOB/TEXT column 'token' used in key specification without a key length: CREATE UNIQUE INDEX `index_dbhero_dataclips_on_token` ON `dbhero_dataclips` (`token`) /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:107:in `_query' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:107:in `block in query' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:106:in `handle_interrupt' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:106:in `query' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `block in execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log' /usr/local/share/ruby/gems/2.3/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:537:in `add_index' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:665:in `block in method_missing' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:634:in `block in say_with_time' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:634:in `say_with_time' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:654:in `method_missing' /home/ec2-user/dbhero/db/migrate/20160616203934_create_dbhero_dataclips.rb:13:in `change' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:608:in `exec_migration' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:1046:in `ddl_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>' /usr/local/share/ruby/gems/2.3/gems/rake-11.2.2/exe/rake:27:in `<top (required)>' ActiveRecord::StatementInvalid: Mysql2::Error: BLOB/TEXT column 'token' used in key specification without a key length: CREATE UNIQUE INDEX `index_dbhero_dataclips_on_token` ON `dbhero_dataclips` (`token`) /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:107:in `_query' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:107:in `block in query' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:106:in `handle_interrupt' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:106:in `query' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `block in execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log' /usr/local/share/ruby/gems/2.3/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:537:in `add_index' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:665:in `block in method_missing' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:634:in `block in say_with_time' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:634:in `say_with_time' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:654:in `method_missing' /home/ec2-user/dbhero/db/migrate/20160616203934_create_dbhero_dataclips.rb:13:in `change' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:608:in `exec_migration' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:1046:in `ddl_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>' /usr/local/share/ruby/gems/2.3/gems/rake-11.2.2/exe/rake:27:in `<top (required)>' Mysql2::Error: BLOB/TEXT column 'token' used in key specification without a key length /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:107:in `_query' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:107:in `block in query' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:106:in `handle_interrupt' /home/ec2-user/.gem/ruby/2.3/gems/mysql2-0.4.4/lib/mysql2/client.rb:106:in `query' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `block in execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log' /usr/local/share/ruby/gems/2.3/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:537:in `add_index' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:665:in `block in method_missing' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:634:in `block in say_with_time' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:634:in `say_with_time' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:654:in `method_missing' /home/ec2-user/dbhero/db/migrate/20160616203934_create_dbhero_dataclips.rb:13:in `change' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:608:in `exec_migration' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:768:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:1046:in `ddl_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate' /usr/local/share/ruby/gems/2.3/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>' /usr/local/share/ruby/gems/2.3/gems/rake-11.2.2/exe/rake:27:in `<top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace)
My environment:
[ec2-user@ip dbhero]$ cat /etc/*-release NAME="Amazon Linux AMI" VERSION="2016.03" ID="amzn" ID_LIKE="rhel fedora" VERSION_ID="2016.03" PRETTY_NAME="Amazon Linux AMI 2016.03" ANSI_COLOR="0;33" CPE_NAME="cpe:/o:amazon:linux:2016.03:ga" HOME_URL="http://aws.amazon.com/amazon-linux-ami/" Amazon Linux AMI release 2016.03 [ec2-user@ip dbhero]$ gem list *** LOCAL GEMS *** actionmailer (4.2.6) actionpack (4.2.6) actionview (4.2.6) activejob (4.2.6) activemodel (4.2.6) activerecord (4.2.6) activesupport (4.2.6) addressable (2.4.0) arel (6.0.3) bigdecimal (1.2.8) binding_of_caller (0.7.2) builder (3.2.2) bundler (1.12.5) byebug (9.0.5) coffee-rails (4.1.1) coffee-script (2.4.1) coffee-script-source (1.10.0) concurrent-ruby (1.0.2) dbhero (1.1.9) debug_inspector (0.0.2) erubis (2.7.0) execjs (2.7.0) faraday (0.9.2) globalid (0.3.6) google-api-client (0.9.9) google_drive (2.0.1) googleauth (0.5.1) has_scope (0.7.0) httpclient (2.8.0) hurley (0.2) i18n (0.7.0) io-console (0.4.5) jbuilder (2.5.0) jquery-rails (4.1.1) json (1.8.3) jwt (1.5.1) little-plugger (1.1.4) logging (2.1.0) loofah (2.0.3) mail (2.6.4) memoist (0.14.0) mime-types (3.1) mime-types-data (3.2016.0521) mini_portile2 (2.1.0) minitest (5.9.0) multi_json (1.12.1) multi_xml (0.5.5) multipart-post (2.0.0) mysql2 (0.4.4) nokogiri (1.6.8) oauth (0.5.1) oauth2 (1.1.0) os (0.9.6) pkg-config (1.1.7) power_assert (0.2.7) psych (2.0.17) rack (1.6.4) rack-test (0.6.3) rails (4.2.6) rails-deprecated_sanitizer (1.0.3) rails-dom-testing (1.0.7) rails-html-sanitizer (1.0.3) railties (4.2.6) rake (11.2.2) rdoc (4.2.2) representable (2.3.0) responders (2.2.0) retriable (2.1.0) sass (3.4.22) sass-rails (5.0.4) sdoc (0.4.1) signet (0.7.2) slim (3.0.7) slim-rails (3.1.0) spring (1.7.1) sprockets (3.6.0) sprockets-rails (3.0.4) sqlite3 (1.3.11) temple (0.7.7) test-unit (3.1.5) thor (0.19.1) thread_safe (0.3.5) tilt (2.0.5) turbolinks (2.5.3) tzinfo (1.2.2) uber (0.0.15) uglifier (3.0.0) web-console (2.3.0)
I was using Amazon EC2 with MySQL 5.5.
Token could be a varchar to allow MySQL indexes. If you are willing to send a PR I'd gladly review ;)
I was trying to run DBHero on a MySQL database and have some issues related to index.
My environment:
I was using Amazon EC2 with MySQL 5.5.