Forum: Ruby on Rails Foreign Keys in Migrations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ron M. (Guest)
on 2007-07-05 15:35
(Received via mailing list)
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.
Hugh S. (Guest)
on 2007-07-05 17:08
(Received via mailing list)
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
ins/active_record/migrations/fixture_references
+
+

More docs, well, discussion about how to use it at:
http://www.pluginaweek.org/2007/04/07/14-fix-your-...


        HTH
        Hugh
This topic is locked and can not be replied to.