News for hackers. Stuff that matters.
Re:Rails migrations with no downtime by c3 on Monday February 13, 2012 @04:29AM (#3584870)
Basically, it doesn't - because it doesn't need to. Rails/ActiveRecord doesn't use those either. Problem solved :)
Re:Rails migrations with no downtime by morganpyne on Monday February 13, 2012 @04:47AM (#3584913)
Interesting. As you have probably guessed by now, I'm not a Rails developer and therefore did not know this. I was surprised to read about this after your comment and find that Active Record went the lowest common denominator route with this and therefore gave up any native foreign key integrity support.
Re:Rails migrations with no downtime by JonnieCache on Monday February 13, 2012 @06:07AM (#3585128)
There is nothing to stop you using foreign key constraints with rails, the activerecord migration api includes methods to create them for the major db adapters and there are plugins to automate the process to some extent. It's not the Rails Way™ because it sacrifices some database-agnosticity, and therefore almost noone does it. People achieve the same behaviour with application-level validations in the model.

I'd wager that a lot of the big professional rails deployments are doing FK constraints though.

Re:Rails migrations with no downtime by jaylevitt on Monday February 13, 2012 @06:34PM (#3587832)
The gem 'foreigner' makes them painless, and supports Postgres, Oracle, and I think MSSQL.
Re:Rails migrations with no downtime by lectrick on Monday February 13, 2012 @08:58AM (#3585550)
I have never missed foreign keys on the projects I've worked on that don't use them.

This is because those projects typically sit on databases that are only expected to be accessed via web API and not directly from some other source.

Which is basically the Rails philosophy. Only let the app talk to the DB, and let the only outside interface to the DB be through the ORM that has to do most of the data validations anyway.