migration foreign key

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 ...

      add_index :fav, ["lid"], :name => "fk_lid"

      create_table:child ....

      add_constraint "fk_lid" foreign_key ( "lid" ) references :child

  def self.down
      drop_table :child
      drop_table :master

Here is the link that had a good example