I'm using InstantRails 1.6 on Windows XP with Mysql 5.0.27, Rails
1.2.2, and Ruby 1.8.5.
The following foreign key is not working.
class FkLibriid < ActiveRecord::Migration
execute "alter table my_items
add constraint fk_myid
foreign key (myid) references products(myid)"
I declared myid in both tables the same:
t.column :myid, :integer, :null => false
And myid is not primary key in any table. I don't like it to be one.
Additionally, I've set the following in the model for the referenced
C:\Myshop\shop>rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== FkLibriid: migrating