# Foreign Keys in Migrations

**URL:** <https://www.ruby-forum.com/t/foreign-keys-in-migrations/108623>\
**Category:** Rails\
**Created:** [July 5, 2007, 1:35pm UTC](https://www.ruby-forum.com/t/foreign-keys-in-migrations/108623 "2007-07-05T13:35:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rawn027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d07c76/32.png) [@rawn027](https://www.ruby-forum.com/u/rawn027)\
**Post date:** [July 5, 2007, 1:35pm UTC](https://www.ruby-forum.com/t/foreign-keys-in-migrations/108623/1 "2007-07-05T13:35:08Z")

</div>

Is there a way to create the db schema completely through the ruby  
syntax in a migration?  
If i want a relation between table there doesnt seem a way to create  
it when having the environment table set to :ruby instead of :sql and  
using migrations.

Thanks.

---

<div class="post-metadata">

**Author:** ![rawn027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d07c76/32.png) [@rawn027](https://www.ruby-forum.com/u/rawn027)\
**Post date:** [July 5, 2007, 3:08pm UTC](https://www.ruby-forum.com/t/foreign-keys-in-migrations/108623/2 "2007-07-05T15:08:17Z")

</div>

On Thu, 5 Jul 2007, Ron wrote:

> Is there a way to create the db schema completely through the ruby  
> syntax in a migration?  
> If i want a relation between table there doesnt seem a way to create  
> it when having the environment table set to :ruby instead of :sql and  
> using migrations.

I asked this one recently, so I can answer this:

You need the plugin called fixture\_references. There’s not a whole lot  
of documentation for it yet, so I quote the patch I sent them for an  
INSTALL file:

# Index: INSTALL

— INSTALL (revision 0)  
+++ INSTALL (revision 0)  
@@ -0,0 +1,5 @@  
+# Change directory to the RAILS\_ROOT for your project.  
+# Then do:  
+./script/plugin install [http://svn.pluginaweek.org/trunk/plug](http://svn.pluginaweek.org/trunk/plug)  
ins/active\_record/migrations/fixture\_references  
+  
+

More docs, well, discussion about how to use it at:

> **[アコムの審査は甘いのか他社カードローンと審査難易度を比較](https://www.iroop.jp/acom-shinsa/)**
>
> 最近、お笑い芸人の「かまいたち」がCM起用された馴染みある大手消費者金融のアコムは、初めての人でも利用しやすい消費者金融で、今までカードローンを使ったことが無い方におすすめです。 ですがもちろん誰でもお金が借りられる事は...

```
    HTH
    Hugh

```
