Thank you. I resolved the problem. I commented out the following two lines in
006_create_line_items.rb.
execute "alter table line_items
add constraint fk_line_item_products
foreign key (product_id) references products(id)"
execute "alter table line_items
add constraint fk_line_item_orders
foreign key (order_id) references orders(id)"
Ran the migrations and then uncommented them and again ran the migrations. First
time it created
the tables, second time it added the constraints. Hope this helps other readers.
--- Paul Cook <paul@avidmanager.com> wrote:
> First question has to be did you check that the table line_items has
> been created in the depot_development database? Should have done a
> create table in a previous migration or used the mysql command line to
> add the table previous to running this migration.
>
> Bala Paranj wrote:
> > I am following the instructions on Agile Web Development with Rails
book
> > "Iteratio E1: Capturing
> > an Order" section. When I run the migrations I get the following
error.
> >
> > rake db:migrate
> > (in /Users/balaparanj/work/depot)
> > -- execute("alter table line_items \n
> >
> > add constraint fk_line_item_products \n
> > foreign key (product_id) references products(id)")
> > rake aborted!
> > Mysql::Error: Table ''depot_development.line_items''
doesn''t exist: alter
> > table line_items
> > add constraint fk_line_item_products
> > foreign key (product_id) references products(id)
> >
> > (See full trace by running task with --trace)
> >
> > Could some one please tell me how to fix this problem? TIA.
> >
> > http://www.ProblemSolvingSkill.net
> > Hone your problem-solving skills
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
http://www.ProblemSolvingSkill.net
Hone your problem-solving skills