Add foreign key constraints to existing tables in Ruby on Rails (MySQL)
Posted
by randombits
on Stack Overflow
See other posts from Stack Overflow
or by randombits
Published on 2010-04-15T01:50:46Z
Indexed on
2010/04/15
2:03 UTC
Read the original article
Hit count: 267
ruby-on-rails
|migration
What's the best way to add foreign keys to my existing tables in Rails with an underlying MySQL database? clearly the solution should be done in a migration, as I want this versioned. Otherwise I'd create the constraints myself.
I can't seem to find one, conducive response to they above. Again, the tables have already been created with previous migrations. I'm just going back now and adding referential integrity wherever it's applicable.
© Stack Overflow or respective owner