Ruby on Rails Friday, August 13, 2010

Hi,

I am using Rails Fixtures to load some test data to my database and
accidentally I introduced a foreign key out of range.

To my surprise, the database accepted it despite having referential
integrity constraints (that work). I tried with PostgreSQL and with
MySQL InnoDB and both allowed.

Example:

Having in the database "Flavours" whith a numeric primary key (id), 5
entries (1 to 5). I can introduce bad data doing:

Icecream_1:
name: my ice cream
flavour_id: 6

How is it possible that the fixtures loading go around my database
constraints?

Thank you.
--
Posted via http://www.ruby-forum.com/.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment