Hi All, I am trying add a foreign key using db:migrate and getting error. I didn't any documentation on the syntax, if some one has a link, please send it to me if not, please have a look at the following and tell me what am I doing wrong? class name < ActiveRecord:Migration def self.up create_table :master ... end add_index :fav, ["lid"], :name => "fk_lid" create_table:child .... end add_constraint "fk_lid" foreign_key ( "lid" ) references :child ("id") end def self.down drop_table :child drop_table :master end end
on 2007-07-20 21:24
on 2007-07-20 22:21
On Jul 20, 2:23 pm, DBC User <dbcu...@gmail.com> wrote: > end > def self.down > drop_table :child > drop_table :master > end > end Here is the link that had a good example http://www.robbyonrails.com/articles/2005/11/11/ra...