On Sep 28, 4:44 am, Andrew Pace <andrewpp...@gmail.com> wrote:
> Hey all,
>
> I am having a little trouble getting some referential integrity tests
> to work well.
>
> Right now, I am using Postgres as my database.  I have generated
> migrations for my tables and ensured referential integrity by using
> execute commands.  All is working well at the level of the database
> and application.  I can get all the checks to work flawlessly if I set
> up my test database by issuing "rake db:migrate RAILS_ENV=test".
>
> However, if I do the more traditional approach by issuing "rake
> db:test:prepare and rake db:test:load," this seems to load the
> information from the schema.rb file.  This file does not seem to
> contain the foreign key constraints (or other db constraints, for that
> matter).
>

The ruby schema dumper doesn't understand things that activerecord
doesn't, which includes foreign key constraints (There's a plugin
somewhere that adds foreign key support to active record). One way
around this is to set the schema dumper format (in environment.rb)
to :sql rather than ruby. Instead of generating schema.rb,
RAILS_ENV.sql will be generated, using your database's tools.

Fred

> Any thoughts on getting this to work properly and getting the
> schema.rb file to recognize all the db checks?
>
> I can imagine that this will be an issue at the time of production,
> because the schema.rb file will not be usable for setting up the
> production database.  It seems to me, I would have to run the
> migrations...
>
> Thanks,
>
> Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to