So I’m driving myself crazy over the ‘Depot’ application in AWDWR
(Agile Web D. With Rails) for Rails 1.2. I can’t run my
migration script (001_create_products.rb).
I’m receiving the following error when attempting to run the rake
db:migrate command on page 75 of the book:
C:\Rails\rails_apps\depot>rake db:migrate
(in C:/Rails/rails_apps/depot)
C:/Rails/rails_apps/depot/config/boot.rb:26:Warning:
Gem::SourceIndex#search support for String patterns is deprecated
== CreateProducts: migrating
– create_table(:products)
rake aborted!
Mysql::Error: Can’t create table ‘.\depot_development
\products.frm’ (errno: 121): CREATE TABLE products (id
int(11)
DEFAULT NULL auto_increment PRIMARY
KEY, title
varchar(255) DEFAULT NULL, description
text DEFAULT
NULL, image_url
varchar(255) DEFAULT NULL) ENGINE=InnoDB
The MySQL errno: 121 is a foreign key error. I’ve googled and googled
this problem, with nothing useful related to the migration.
I have a feeling there’s going to be a problem between my versions,
I’ve outlined them below in the hope that something obvious jumps out,
else I’m going to uninstall and re-install it all.
Tried with Rails 2.2, simply couldn’t quite handle the scaffold
problems (pg 76-77), so decided to revert back to Rails 1.2.3 - to
achieve this I ran the following:
gem uninstall rails -v=2.2.2
gem install rails -v=1.2.3
These are the versions I’m running below (MySQL courtesy of
InstantRails 2.0):
C:\Rails\rails_apps\depot>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
C:\Rails\rails_apps\depot>rails -v
Rails 1.2.3
C:\Rails\rails_apps\depot>c:\Rails\mysql\bin\mysqladmin.exe -V
c:\Rails\mysql\bin\mysqladmin.exe Ver 8.41 Distrib 5.0.27, for Win32
on ia32