I am beginner for this Rails from the past 2 days I am working hard to fix the following error C:\Murali Rubby\demo\library>rake db:migrate --trace (in C:/Murali Rubby/demo/library) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == CreateBooks: migrating ===================================================-- create_table(:books) rake aborted! An error has occurred, all later migrations canceled: Mysql::Error: Table ''books'' already exists: CREATE TABLE `books` (`id` int(11) D EFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, `updated_at` date time) ENGINE=InnoDB C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti on_adapters/abstract_adapter.rb:219:in `rescue in log'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti on_adapters/abstract_adapter.rb:202:in `log'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti on_adapters/mysql_adapter.rb:323:in `execute'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti on_adapters/abstract/schema_statements.rb:114:in `create_table'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti on_adapters/mysql_adapter.rb:476:in `create_table'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:352:in `block in method_missing'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:328:in `block in say_with_time'' C:/Ruby19/lib/ruby/1.9.1/benchmark.rb:294:in `measure'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:328:in `say_with_time'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:348:in `method_missing'' C:/Murali Rubby/demo/library/db/migrate/20100528200605_create_books.rb:3:in `up'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:282:in `block in migrate'' C:/Ruby19/lib/ruby/1.9.1/benchmark.rb:294:in `measure'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:282:in `migrate'' C:1:in `migrate'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:486:in `block (2 levels) in migrate'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:562:in `call'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:562:in `ddl_transaction'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:485:in `block in migrate'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:472:in `each'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:472:in `migrate'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:400:in `up'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio n.rb:383:in `migrate'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/tasks/databases.rake:116:in ` block (2 levels) in <top (required)>'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execu te'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invok e_with_call_chain'' C:/Ruby19/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_ca ll_chain'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 leve ls) in top_level'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_ level'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exce ption_handling'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exce ption_handling'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'' C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'' C:/Ruby19/bin/rake:19:in `load'' C:/Ruby19/bin/rake:19:in `<main>'' I spend almost like 20 hrs but I didn''t find the way to fix it. I am working on the example given in the tutorialpoint website... Please help me ... Thanks in advance for your time. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
It looks like your mysql database already has a ''books'' table. So either manually reset the database (and the schema) or run the appropriate rake tasks to undo what you''ve done... If you don''t care about any of the data in there you could do> rake db:drop db:create db:migrateto get back to this point... type "rake -T db" to see your other options On May 28, 2010, at 3:06 PM, Krishna Venkata wrote:> I am beginner for this Rails from the past 2 days I am working hard > to fix the following error > > C:\Murali Rubby\demo\library>rake db:migrate --trace > (in C:/Murali Rubby/demo/library) > ** Invoke db:migrate (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:migrate > == CreateBooks: migrating > ===================================================> -- create_table(:books) > rake aborted! > An error has occurred, all later migrations canceled: > > Mysql::Error: Table ''books'' already exists: CREATE TABLE `books` (`id` > int(11) D > EFAULT NULL auto_increment PRIMARY KEY, `created_at` datetime, > `updated_at` date > time) ENGINE=InnoDB > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti > on_adapters/abstract_adapter.rb:219:in `rescue in log'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti > on_adapters/abstract_adapter.rb:202:in `log'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti > on_adapters/mysql_adapter.rb:323:in `execute'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti > on_adapters/abstract/schema_statements.rb:114:in `create_table'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/connecti > on_adapters/mysql_adapter.rb:476:in `create_table'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:352:in `block in method_missing'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:328:in `block in say_with_time'' > C:/Ruby19/lib/ruby/1.9.1/benchmark.rb:294:in `measure'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:328:in `say_with_time'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:348:in `method_missing'' > C:/Murali > Rubby/demo/library/db/migrate/20100528200605_create_books.rb:3:in `up'' > > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:282:in `block in migrate'' > C:/Ruby19/lib/ruby/1.9.1/benchmark.rb:294:in `measure'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:282:in `migrate'' > C:1:in `migrate'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:486:in `block (2 levels) in migrate'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:562:in `call'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:562:in `ddl_transaction'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:485:in `block in migrate'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:472:in `each'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:472:in `migrate'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:400:in `up'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/migratio > n.rb:383:in `migrate'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/tasks/databases.rake:116:in > ` > block (2 levels) in <top (required)>'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block > in execu > te'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in > `execute'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block > in invok > e_with_call_chain'' > C:/Ruby19/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in > `invoke_with_ca > ll_chain'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in > `invoke'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in > `invoke_task'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block > (2 leve > ls) in top_level'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block > in top_ > level'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in > `standard_exce > ption_handling'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in > `top_level'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block > in run'' > > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in > `standard_exce > ption_handling'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'' > C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top > (required)>'' > C:/Ruby19/bin/rake:19:in `load'' > C:/Ruby19/bin/rake:19:in `<main>'' > > I spend almost like 20 hrs but I didn''t find the way to fix it. > > I am working on the example given in the tutorialpoint website... > Please help me ... Thanks in advance for your time. > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Philip, Earlier I manual dropped all the tables that didn''t fix the problem Now used rake db:drop db:create db:migrate but still geting rake aborted message.. C:\Murali Rubby\demo\library>rake db:drop db:create db:migrate (in C:/Murali Rubby/demo/library) rake aborted! Mysql::Error: Specified key was too long; max key length is 767 bytes: CREATE UN IQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`) (See full trace by running task with --trace) So please provide some other Info to fix that... Thank you so much for your quick reply. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Philip Hallstrom
2010-May-28 22:40 UTC
Re: Re: Beginner Facing Problem with rake db:migrate
On May 28, 2010, at 3:33 PM, Krishna Venkata wrote:> Hi Philip, > > Earlier I manual dropped all the tables that didn''t fix the problem > Now used rake db:drop db:create db:migrate but still geting rake > aborted message.. > > C:\Murali Rubby\demo\library>rake db:drop db:create db:migrate > > (in C:/Murali Rubby/demo/library) > rake aborted! > Mysql::Error: Specified key was too long; max key length is 767 bytes: > CREATE UN > IQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`) > > > (See full trace by running task with --trace) > > So please provide some other Info to fix that...Heh. Google for your mysql error and you''ll find this thread which is *exactly* the same problem... even down to the same tables... http://www.ruby-forum.com/topic/157223 Good luck! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.