This one's really an off shoot of another question I asked, earlier today.
Basically, it seems like it's not the rails way to have database level constraints (foreign keys) in RoR. At least, they're not natively supported. There's this Foreigner Gem or I could go primitive and use raw SQL
through execute
in rails migrations.
My question is, are there any pitfalls I need to be aware of when using the execute
route. Here are a few that I that I'm aware of:
- Writing db seeds/fixtures can get tricky, perhaps impossible for some cases
- Managing db migrations becomes difficult, as the foreign keys would never be dumped in
db/schema.rb
- Polymorphic foreign keys would not be possible (I don't even know what they are, so, I shouldn't miss those)
Are there any other pitfalls that I should be aware of?