Unique Marketing, Guaranteed Results.

Foreign Key Migrations Plugin

April 2nd, 2009 by Chuck Wood

I worked on a plugin yesterday that would include all of our migration helpers. You can find it on github. Currently, it only does foreign keys work, but eventually, I’d like to have it add unique indexes on columns defined with a :unique => true attribute in the ActiveRecord migration. But for right now, here’s how to use it:

Adding a foreign key that references the id column in another table:

# The column 'id' is assumed in the referenced table.
add_foreign_key :table1, :table2_ref, :table2

Read the rest of this entry »


Copyright © 2005-2010 PMA Media Group. All Rights Reserved . Online Degrees | Train for a Better Career | My Colleges and Careers Site Map