Rake aborted! Mysql::Error

Hi,I followed the process of creating depot in the book ‘Ruby on Rails’
all works fine until I came to the ‘Checkout’ chapter.

After I created the two models order and line_item and got the two
migration file altered according to the book, I failed by running rake
db:migrate

errors are shown as below

C:\Java\workspace\depot>rake db:migrate
(in C:/Java/workspace/depot)
== CreateLineItems: migrating

– create_table(:line_items)
rake aborted!
Mysql::Error: #42S01Table ‘line_items’ already exists: CREATE TABLE
line_items (
id int(11) DEFAULT NULL auto_increment PRIMARY KEY, product_id
int(11) NOT N
ULL, order_id int(11) NOT NULL, quantity int(11) NOT NULL,
total_price int
(11) NOT NULL) ENGINE=InnoDB

By running --trace I can also see

C:\Java\workspace\depot>rake db:migrate -trace
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
re quire__': no such file to load -- ace (LoadError) from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require .rb:21:inrequire’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:
1749:in do_option' from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb: 1787:inhandle_options’
from C:/InstantRails/ruby/lib/ruby/1.8/getoptlong.rb:460:in
each' from C:/InstantRails/ruby/lib/ruby/1.8/getoptlong.rb:457:ineach’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:
1787:in handle_options' from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb: 1897:inrun’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
from C:/InstantRails/ruby/bin/rake.bat:25

I followed the book strictly, so couldn;t figured out what has happened.

anybody has a similar/same problem using this book? greatly appreciated
for your help!

Is that table already in the system? If so, you may have to use the
“force” option with create_table. Did you happen to run rake migrate
before you added the columns?

Jacquie F. [email protected] wrote:
Hi,I followed the process of creating depot in the book ‘Ruby on Rails’
all works fine until I came to the ‘Checkout’ chapter.

After I created the two models order and line_item and got the two
migration file altered according to the book, I failed by running rake
db:migrate

errors are shown as below

C:\Java\workspace\depot>rake db:migrate
(in C:/Java/workspace/depot)
== CreateLineItems: migrating

– create_table(:line_items)
rake aborted!
Mysql::Error: #42S01Table ‘line_items’ already exists: CREATE TABLE
line_items (
id int(11) DEFAULT NULL auto_increment PRIMARY KEY, product_id
int(11) NOT N
ULL, order_id int(11) NOT NULL, quantity int(11) NOT NULL,
total_price int
(11) NOT NULL) ENGINE=InnoDB

By running --trace I can also see

C:\Java\workspace\depot>rake db:migrate -trace
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
re quire__': no such file to load -- ace (LoadError) from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require .rb:21:inrequire’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:
1749:in do_option' from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb: 1787:inhandle_options’
from C:/InstantRails/ruby/lib/ruby/1.8/getoptlong.rb:460:in
each' from C:/InstantRails/ruby/lib/ruby/1.8/getoptlong.rb:457:ineach’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:
1787:in handle_options' from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb: 1897:inrun’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
from C:/InstantRails/ruby/bin/rake.bat:25

I followed the book strictly, so couldn;t figured out what has happened.

anybody has a similar/same problem using this book? greatly appreciated
for your help!


Posted via http://www.ruby-forum.com/.


Get your email and more, right on the new Yahoo.com

Thanks for the help! The migration works now by adding :force=>true

Will G. wrote:

Is that table already in the system? If so, you may have to use the
“force” option with create_table. Did you happen to run rake migrate
before you added the columns?

Jacquie F. [email protected] wrote:
Hi,I followed the process of creating depot in the book ‘Ruby on Rails’
all works fine until I came to the ‘Checkout’ chapter.

After I created the two models order and line_item and got the two
migration file altered according to the book, I failed by running rake
db:migrate

Right, but bear in mind the force=>true overwrites your data. Please
tell me you didn’t learn it the hard way like I did…

Jacquie F. [email protected] wrote:
Thanks for the help! The migration works now by adding :force=>true

Will G. wrote:

db:migrate

Posted via http://www.ruby-forum.com/.


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great
rates starting at 1¢/min.

Ugh. The way I said that sounds kind of bad. I just hope I didn’t cause
you to have to re-enter a whole mess of data (like I’ve done a couple of
times)…

Will G. [email protected] wrote: Right, but bear in mind the
force=>true overwrites your data. Please tell me you didn’t learn it the
hard way like I did…

Jacquie F. [email protected] wrote:
Thanks for the help! The migration works now by adding :force=>true

Will G. wrote:

db:migrate

Posted via http://www.ruby-forum.com/.


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great
rates starting at 1¢/min.


All-new Yahoo! Mail - Fire up a more powerful email and get things done
faster.

I’m having a similar problem here… I’m not able to get rid of force
=> true flag. On every migration or “rake db:fixtures:load” I run, the
db/schema.db file is updated with force=>true.

What am I missing ? Is there any config/environment.rb setting I’ve to
add/modify to get rid of force=>true ?

Thanks in advance.

Thanks for reminding me. No I didn’t enter anything yet.=)

Will G. wrote:

Ugh. The way I said that sounds kind of bad. I just hope I didn’t cause
you to have to re-enter a whole mess of data (like I’ve done a couple of
times)…

Will G. [email protected] wrote: Right, but bear in mind the
force=>true overwrites your data. Please tell me you didn’t learn it the
hard way like I did…


All-new Yahoo! Mail - Fire up a more powerful email and get things done
faster.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs