foreign key not working

Hello,

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   def self.up     execute "alter table my_items              add constraint fk_myid              foreign key (myid) references products(myid)"   end

  def self.down   end end

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 table: validates_uniqueness_of :myid

C:\Myshop\shop>rake db:migrate --trace (in C:/Myshop/shop) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == FkLibriid: migrating